Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WORD: turn headers on and off
Message
De
08/03/2001 12:57:13
 
 
À
07/03/2001 13:15:39
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00482750
Message ID:
00483228
Vues:
8
Tamar,
I re-read WORD basics in your book and I have a idea. I created a document called mydoc.doc that has the content that I want to appear in the letter. MyDoc.Doc has text of different fonts and several merge fields that have different fonts. I created another document called myheaderdoc.doc that contains the header that I would like to be combined with mydoc.doc. I first get oWord created and then get a handle on mydoc.doc's content ie:

oWord=createobj("WORD.APPLICATION")
oWord.documents.open("c:\my documents\MyDoc.doc")
oRange = oword.activedocument.range()

Then I get a handle on myheaderdoc.doc
oWord.documents.open("c:\my documents\MyHeaderDoc.doc")
Now I insert the content from mydoc.doc into myHeaderdoc.doc. But all I get is the pure text. How do I get the text, formatting of the text (ie:fonts, etc)and any merge fields (with their fonts) from mydoc.doc. oRange.text just gives me the text but none of the good stuff.

Neil






>>Hi,
>>
>>I am using WORD automation. I have a letter that I want to print. I have included a header that mimics my letterhead. But sometimes I don't need it. Is there a way to turn the header on and off under automation? Is there a way when not in automation mode to have WORD print the letter with or without the header without totally deleting the header??
>>
>>Neil
>
>I don't know a way to print a document without the header once you put it in. Your best bet is to use two different templates - one with the header and one without.
>
>With Automation, headers and footers are stored in a separate HeaderFooters collection for each section of the document. You access it through the Headers and Footers properties of the section object. Here's an excerpt from my book ("Microsoft Office Automation with Visual FoxPro"):
>
>The kinds of headers and footers in a document (different first page, different on odd/even pages) are controlled through the PageSetup object and are discussed in the section "Setting up pages" earlier in this chapter. Header and footer content is stored in HeaderFooter objects, which are part of a HeaderFooters collection, accessed through the Headers and Footers properties of the Section object. Any section can have up to three of each, accessed via the constants wdHeaderFooterPrimary (1), wdHeaderFooterFirstPage (2), and wdHeaderFooterEvenPages (3).
>
>Once you find the header you want, you can deal with its contents like any other part of a document.
>
>Tamar
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform