Hi all,
I have my method of getting content controls which was posted in a previous post. What I want to know is, how can I get the items of a combobox control, and how can I edit the items in one?
Thanks, Hampo
Betsy wrote:Hello,
Thanks for your inquiry.
Sorry at present Spire.Doc doesn’t support the features which get the items of a combobox control and edit the items in one.
Please feel free to contact us, if there are any questions or needs.
Best Regards,
Betsy
E-iceblue support team
Betsy wrote:Hello,
The new feature has added in our schedule. Once there are any processes, I will let you know.
Please feel free to contact us, if you have any questions or needs.
Thanks,
Betsy
E-iceblue support team
Betsy wrote:Hello,
I am sorry that I could not tell you a rough ETA of it. Once there are any processes, I will inform you immediately.
Thanks,
Betsy
E-iceblue support team
Function updateFields(ByVal wordDocPath As String, ByVal tag As String, ByVal emails As List(Of String)) As Integer
'Return 0: Success
'Return 1: Content Control not found or not a dropdown
'Return 2: No doc path specified
'Return 3: Exception occured - Maybe doc is open
Try
If wordDocPath <> "" AndAlso (wordDocPath.EndsWith(".docx") Or wordDocPath.EndsWith(".dotm")) Then
Using wordDoc As System.IO.Compression.ZipArchive = System.IO.Compression.ZipFile.Open(wordDocPath, System.IO.Compression.ZipArchiveMode.Update)
Dim xmlEntry As System.IO.Compression.ZipArchiveEntry = wordDoc.GetEntry("word/document.xml")
Dim xml As String = ""
Using sr As New System.IO.StreamReader(xmlEntry.Open, System.Text.Encoding.UTF8)
xml = sr.ReadToEnd
End Using
Dim contentControl As String = ""
Dim col As System.Text.RegularExpressions.MatchCollection
col = System.Text.RegularExpressions.Regex.Matches(xml, "<w:sdt>(.*?)</w:sdt>")
For Each m As System.Text.RegularExpressions.Match In col
Dim sdt As String = m.Groups(1).Value
If sdt.Contains("<w:dropDownList>") AndAlso sdt.ToLower.Contains("<w:tag w:val=""" + tag.ToLower + """/>") Then
contentControl = m.Groups(1).Value
Exit For
End If
Next
If String.IsNullOrWhiteSpace(contentControl) Then
Return 1
End If
For Each email As String In emails
Dim newItems As String = ""
For Each item As String In emails
newItems += "<w:listItem w:displayText=""" + item + """ w:value=""" + item + """/>"
Next
col = System.Text.RegularExpressions.Regex.Matches(contentControl, "<w:dropDown(.*?)DownList>")
xml = xml.Replace(col.Item(0).Groups(1).Value, "List>" + newItems + "</w:drop")
Next
xmlEntry.Delete()
Dim newEntry As System.IO.Compression.ZipArchiveEntry = wordDoc.CreateEntry("word/document.xml")
Using sw As New System.IO.StreamWriter(newEntry.Open, System.Text.Encoding.UTF8)
sw.WriteLine(xml)
End Using
End Using
Return 0
Else
Return 2
End If
Catch ex As Exception
Return 3
End Try
End Function
Betsy wrote:Hello,
Sorry for long silence.
There is some code for your reference, and please download the temporary version from the following link and have a try:
http://www.e-iceblue.com/downloads/temp ... 5.4.13.zip
Sincerely,
Betsy
E-iceblue support team