Adding a automatic page numbering to a footer

Questions and answers on how to use DOCXReadWrite

Adding a automatic page numbering to a footer

Postby Michel Huybrechts » Sun Sep 10, 2017 1:46 pm

Using the examples from the samples I see how to add headers and footers to a page. I also figured out how to add tabs and figures. However, I can't find a way to add an automatic page numbering. The documentation does not explain this either.

How to add "page <#>" in a footer such that MSWord automatically fills in the <#> for each page?

Thank you
Michel Huybrechts
 
Posts: 3
Joined: Sun Sep 10, 2017 1:30 pm

Re: Adding a automatic page numbering to a footer

Postby larsa » Sun Sep 10, 2017 3:55 pm

Hello

You uses field codes for this.

Example:
Code: Select all
  DOCX.Editor.MainDoc.Headers.AddDefault;
  DOCX.Editor.MainDoc.Headers.Default_.Paras[0].AppendField('1','PAGE');

'1' is the default value. 'PAGE' is the field code
Lars Arvidsson, Axolot Data
larsa
Site Admin
 
Posts: 624
Joined: Mon Jun 27, 2005 9:30 pm

Re: Adding a automatic page numbering to a footer

Postby Michel Huybrechts » Mon Sep 11, 2017 12:17 pm

Thank you, this works perfectly
Michel Huybrechts
 
Posts: 3
Joined: Sun Sep 10, 2017 1:30 pm


Return to DOCXReadWrite

Who is online

Users browsing this forum: No registered users and 1 guest

cron