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.

Tue Sep 17, 2013 10:11 pm

Is it possible to read the contents of objects in MS Word Forms such as a TextBox, Drop Down List, or Calendar? If so, are there examples of how to do this with Spire?

Thanks,

-Frank

fwingate
 
Posts: 1
Joined: Tue Sep 17, 2013 7:53 pm

Wed Sep 18, 2013 7:55 am

Thanks for your inquiry.

Sorry that at present our Spire product doesn't support the feature that reading the contents of objects in MS Word Forms such as a Drop Down List, or Calendar, but you could refer to the following method to read the content of a TextBox.
Code: Select all
 
Document doc = new Document();
doc.LoadFromFile(string filename);
StringBuilder sb=new StringBuilder();
foreach (Paragraph para in doc.Sections[0].Paragraphs)
     {
           foreach (var item in para.Items)
                {
                    if (item is Spire.Doc.Fields.TextBox)
                    {
                        foreach (Paragraph paras in (item as Spire.Doc.Fields.TextBox).ChildObjects)
                        {
                            sb.AppendLine(paras.Text);
                        }
                    }
                }
            }
Console.WriteLine(sb);
Console.ReadLine();

If there are any questions, welcome to get it back to us.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue Sep 24, 2013 9:14 am

Hello,

Have you tried the method to read the content of a TextBox? Does it fulfill your needs? Could you please give us some feedback if convenience?
If there are any questions, welcome to get it back to us.
Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.Doc

cron