I want to add a page X of Y numbering in a word file generated via Delphi which is: - not bold; - in font size 8; - aligned to the right.
Note that: Y is the total number of pages; X is the index of the page number.
So far I've found this:
procedure Print;
var v:olevariant;
v:=CreateOleObject('Word.Application');
v.Documents.Add;
HeaderandFooter;
firstpage:=true;
procedure HeaderandFooter;
var adoc,:olevariant;
begin
adoc.Sections.Item(1).Headers.Item(wdHeaderFooterPrimary).Range.Font.Size := 8;
adoc.Sections.Item(1).Footers.Item(wdHeaderFooterPrimary).PageNumbers.Add(wdAlignPageNumberRight);
I can change the format of the numbering:
adoc.Sections.Item(1).Footers.Item(wdHeaderFooterPrimary).PageNumbers.NumberStyle := wdPageNumberStyleLowercaseRoman;
But there is no option for page X of Y format. How do I implement that?
MSWord.Selection.ParagraphFormat.Alignment := wdAlignParagraphRight;
– Petermch Jan 08 '16 at 09:44