Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu Mar 12, 2015 2:34 pm

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

Hampo
 
Posts: 28
Joined: Thu Jan 22, 2015 2:29 pm

Fri Mar 13, 2015 6:48 am

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
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Fri Mar 13, 2015 8:59 am

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


Unfortunately this is needed for what I am doing. Would it be possible to add support at some point in the very near future?

Hampo
 
Posts: 28
Joined: Thu Jan 22, 2015 2:29 pm

Fri Mar 13, 2015 9:25 am

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
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Fri Mar 13, 2015 10:05 am

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


Is there even a rough ETA of it?

Hampo
 
Posts: 28
Joined: Thu Jan 22, 2015 2:29 pm

Mon Mar 16, 2015 1:59 am

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
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Mon Mar 16, 2015 8:53 am

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


Thanks. Hopefully it's done in time.

Hampo
 
Posts: 28
Joined: Thu Jan 22, 2015 2:29 pm

Mon Mar 30, 2015 8:10 am

Any update on this? I'm being chased by my MD.

Hampo
 
Posts: 28
Joined: Thu Jan 22, 2015 2:29 pm

Mon Mar 30, 2015 9:23 am

Hello,

Thanks for your inquiry.
I am afraid that there are no any processes. Due to complexity of the issue, we need more time. We will inform you when the new feature is done.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Mon Mar 30, 2015 9:41 am

That's fine, it's just so I have an answer for my MD

Hampo
 
Posts: 28
Joined: Thu Jan 22, 2015 2:29 pm

Fri May 01, 2015 7:58 am

I have actually made my own method for this. It probably isn't the most efficient way, but surely if I can do it in the space of a few hours, your dev team can do it properly?

The wordDocPath is the location of the word file, the tag is the SDTProperties.Tag of the CC, and the emails is the list of items to set the drop down items to. This function can easily be modified to add items instead of set them though.
Code: Select all
    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

Hampo
 
Posts: 28
Joined: Thu Jan 22, 2015 2:29 pm

Fri May 01, 2015 8:33 am

Hello,

Thanks for your reply.
I will post it to our dev team. We will tell you when there is any update.

Sincerely,
Sweety
E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Fri May 08, 2015 9:13 am

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
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Tue May 12, 2015 1:27 pm

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


This works perfectly, thank you. Will this be an actual release soon?

Hampo
 
Posts: 28
Joined: Thu Jan 22, 2015 2:29 pm

Wed May 13, 2015 5:57 am

Hello,

Now, the version( Spire.Doc Pack Version:5.4.15 ) has been released, please download it from the following link and have a try:
http://www.e-iceblue.com/Download/downl ... t-now.html

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Return to Spire.Doc