Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files from any .NET platform (C#, VB.NET, ASP.NET, .NET Core) and Java applications (J2SE and J2EE) with fast and high quality performance.

Wed Jan 26, 2011 3:08 am

I want to set the page header with special format, for example, the first page, total five pages. And the header should be put on the right. Can you help me?
Thanks in advance.

eternalsummer
 
Posts: 11
Joined: Mon Dec 13, 2010 7:31 am

Wed Jan 26, 2011 9:28 am

Thank you for your inquiry! :P
You may append field in the paragraph and append page number into the field. Further more, you may set headerParagraph.Format.HorizontalAlignment property of the header paragraph to specify the alignment of the text.
Code: Select all
Paragraph headerParagraph = header.AddParagraph();
headerParagraph.AppendField("page number", FieldType.FieldPage);
headerParagraph.AppendText(" of ");
headerParagraph.AppendField("number of pages", FieldType.FieldNumPages);
headerParagraph.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Right;
e-iceblue support
User avatar

iceblue support
 
Posts: 240
Joined: Tue Dec 21, 2010 2:56 am

Return to Spire.Doc