Board index » delphi » Adding page numbers to a word document

Adding page numbers to a word document

I have an application that creates a document of a number of word merged
word documents, including a table of contents.
I have been trying to work with
WordApp.ActiveDocument.Sections.Item(1).Footers.Item(1).PageNumbers.Add('CENTER',
1). The second parameter appears to be the problem. I have tried
numerous parameters but to no avail.
Using EmptyParam in each has the same affect as not inserting no page
numbers.
Can anyone help me add page numbers to this merged document.
Thanks for your help
Dennis
 

Re:Adding page numbers to a word document


<<Chris wolter:
Can anyone help me add page numbers to this merged
document.

Quote

var
  Alignment, OnFirstPage: OleVariant;
..
  Alignment := wdAlignPageNumberCenter;
  OnFirstPage := False;
  Doc.Sections.Item(1).Footers.Item(
    wdHeaderFooterPrimary).PageNumbers.Add(Alignment,      
         OnFirstPage);

wdAlignPageNumberCenter and wdHeaderFooterPrimary are both
constants defined in the Word type library as 1.

--
Deborah Pate (TeamB) http://delphi-jedi.org

  Use Borland servers; TeamB don't see posts via ISPs
  http://www.borland.com/newsgroups/genl_faqs.html

Re:Adding page numbers to a word document


THANK YOU, Deborah!!!
The code worked great. Keep up the good work.
Dennis
Quote
"Deborah Pate (TeamB)" wrote:
> <<Chris wolter:
> Can anyone help me add page numbers to this merged
> document.

> var
>   Alignment, OnFirstPage: OleVariant;
> ..
>   Alignment := wdAlignPageNumberCenter;
>   OnFirstPage := False;
>   Doc.Sections.Item(1).Footers.Item(
>     wdHeaderFooterPrimary).PageNumbers.Add(Alignment,
>          OnFirstPage);

> wdAlignPageNumberCenter and wdHeaderFooterPrimary are both
> constants defined in the Word type library as 1.

> --
> Deborah Pate (TeamB) http://delphi-jedi.org

>   Use Borland servers; TeamB don't see posts via ISPs
>   http://www.borland.com/newsgroups/genl_faqs.html

Other Threads