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.

Mon Nov 24, 2014 6:27 am

Hello, I'd like to add the page numeration on the footer/header of a document.
Could you point me in the right direction?
Thanks in advance
Mario

vernarim
 
Posts: 10
Joined: Sat Oct 25, 2014 4:55 pm

Mon Nov 24, 2014 8:07 am

Dear vernarim,

Thanks for your inquiry.

For your requirement, please refer to the code below:
Code: Select all
HeaderFooter footer = section.HeadersFooters.Footer;
Paragraph footerParagraph = footer.AddParagraph();
footerParagraph.AppendField("page number", FieldType.FieldPage);
footerParagraph.AppendText(" of ");
footerParagraph.AppendField("number of pages", FieldType.FieldNumPages);
footerParagraph.Format.HorizontalAlignment = HorizontalAlignment.Right;

Best Regards,
Burning
E-iceblue Support Team
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Tue Nov 25, 2014 5:31 am

Awesome!
It works like a charm...

I suggest to add the snippet in the tutorial.
Regards

vernarim
 
Posts: 10
Joined: Sat Oct 25, 2014 4:55 pm

Tue Nov 25, 2014 6:01 am

Dear vernarim,

Please feel free to contact us if you have any problems.

Best Regards,
Burning
E-icebblue Support Team
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Return to Spire.Doc