Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How To add text and page number to word documents footer
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00951777
Message ID:
00951788
Vues:
10
This message has been marked as the solution to the initial question of the thread.
>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?
>

It is centered for the parameter passed to the add method indicates the alignment, change it to:

oword.Documents.Item(1).Sections(1).Footers.Item(1).PageNumbers.Add(2)

to have it right-aligned

>
>	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
>
And for adding the text, I believe that this might work:

oword.Documents.Item(1).Sections(1).Footers.Item(1).Range.Text = 'Application Name'
oword.Documents.Item(1).Sections(1).Footers.Item(1).PageNumbers.Add(2)

>
>Thanks
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform