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:54 am

We have a template for mail merge that contains a textbox inside of a header.
The position of the textbox is fixed in an absolute position.

We didn't find a way to define a textbox inside of a header with Spire.

Can you assist?

diligent GmbH
 
Posts: 2
Joined: Tue Jan 29, 2013 7:29 am

Wed Sep 18, 2013 8:05 am

Thanks for your inquiry.

You could refer to the following method to define a textbox inside of a header with Spire.
Code: Select all
Document doc = new Document();
doc.LoadFromFile(@"..\..\Sample .doc");
HeaderFooter header = doc.Sections[0].HeadersFooters.FirstPageHeader;
StringBuilder sb = new StringBuilder();
foreach (Paragraph para in header.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:06 am

Hello,

Have you tried the method? Has the issue been resolved? Could you please give us some feedback if convenience?

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 Oct 15, 2013 7:47 am

Hi,
yes, works for us.
Thanks a lot!

diligent GmbH
 
Posts: 2
Joined: Tue Jan 29, 2013 7:29 am

Wed Oct 16, 2013 5:57 am

Thanks for your reply. Happy to hear that.
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

Return to Spire.Doc

cron