Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How To add text and page number to word documents footer
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00951777
Message ID:
00951805
Views:
6
This message has been marked as a message which has helped to the initial question of the thread.
Perhaps this will help
#DEFINE wdSeekPrimaryFooter 4
#DEFINE wdFieldPage 33
LOCAL oWord,loDoc
oWord = CREATEOBJECT('word.application')
loDoc = oWord.documents.add()
SET STEP ON 
oWord.ActiveWindow.ActivePane.View.SeekView= wdSeekPrimaryFooter
WITH oWord.selection
   .Fields.Add(oword.Selection.Range,wdFieldPage)
   .TypeText("   This is page one")
ENDWITH
oword.visible = .t.
>In the code below, I have page numbers that are added to the footer of the word document. The page number is centered, apparently automaticly. I'd like to add text to the left portion of the footer "Application Name" and have the page number on right. Anybody have some clues how to do this?
>
>
>	oWord=CREATEOBJECT("Word.Application")
>	IF VARTYPE(oWord)=[O]
>		oWord.documents.open("c:\stats.htm")
>		oword.Documents.Item(1).Sections(1).Footers.Item(1).PageNumbers.Add(1)
>		oword.documents.item(1).sections(1).footers.
>		oword.ActiveDocument.PrintOut
>		oWord.Documents.Close()
>		oWord=.null.
>		release oWord		
>	ELSE
>		thisform.olecontrol1.document.execCommand("Print")
>	ENDIF
>
>
>Thanks
Previous
Reply
Map
View

Click here to load this message in the networking platform