Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word: omit header on all but first page
Message
 
À
05/05/2006 13:52:42
Charlie Hancock
California Dept of Public Health
Richmond, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01119691
Message ID:
01119741
Vues:
17
You need to divide document by sections. Something like this:
wdSectionBreakNextPage=2

wdHeaderFooterPrimary=1
Wdheaderfooterfirstpage=2
wdStatisticPages = 2

if oWord.ActiveDocument.ComputeStatistics(wdStatisticPages) >1

   with oWord
        .Selection.GoTo(,,2)
	.Selection.InsertBreak(wdSectionBreakNextPage)
	with .ActiveDocument.Sections(2)
		.Headers(wdHeaderFooterPrimary).LinkToPrevious = .f.
		.Footers(wdHeaderFooterPrimary).LinkToPrevious = .f.
		.Headers(wdHeaderFooterPrimary).Range.Text = ""
		.Footers(wdHeaderFooterPrimary).Range.Text = ""
	endwith

.......
>I'm trying to automate Word 2002 from VFP 9 for the first time. I have one Word doc that acts as letterhead (has only a header & footer). I have another doc that contains boilerplate text. I'm trying to insert the text into the letterhead, and I only want the header & footer to appear on the first page of the final doc.
>
>My approach so far:
>
>1. Open the letterhead doc.
>2. Save it as another name, using the SaveAs() method.
>3. In the resulting doc, use the Insert() method to insert my boilerplate text doc.
>
>So far, so good. But if the doc is now more than one page, I only want the original letterhead header & footer on the first page. I've tried setting PageSetup.DifferentFirstPageHeaderFooter = .T., but that ends up including the header & footer on all *except* the first page. If I set PageSetup.OddAndEvenPagesHeaderFooter = .T., I get the result I want, but only if the final document is two pages; the header & footer reappear on all odd-numbered pages.
>
>Thanks in advance for any suggestions!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform