Is there a way to add page numbers to the lower right corner of a Word document using Python win32com? I am able to add headers and footers, but I can't find a way to add page numbers in the format PageNumber of TotalPages (for example: 1 of 5)
Below is the code to add centered headers and footers to a page
from win32com.client import Dispatch as MakeDoc
filename = name + '.doc'
WordDoc = MakeDoc("Word.Application")
WordDoc = WordDoc.Documents.Add()
WordDoc.Sections(1).Headers(1).Range.Text = name
WordDoc.Sections(1).Headers(1).Range.ParagraphFormat.Alignment = 1
WordDoc.Sections(1).Footers(1).Range.Text = filename
WordDoc.Sections(1).Footers(1).Range.ParagraphFormat.Alignment = 1
Thanks
WordDoc.Sections(1).Footers(1).PageNumbers.Add(2,True)WordDoc.Sections(1).Footers(1).PageNumbers.NumberStyle = 57However, the format of the number is -PageNumber- instead of the one I was looking for, but I'm fine with it anyways