Information générale
Catégorie:
COM/DCOM et OLE Automation
>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement