Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word Automation - Sections/Headers/Footers
Message
 
À
23/07/2002 08:50:46
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00681560
Message ID:
00681588
Vues:
13
Try to use .ActiveDocument.Sections(i) approach instead. Like:

with .ActiveDocument.Sections(1)
.Headers(wdHeaderFooterPrimary).Range.Text = "Header1 text"
.Footers(wdHeaderFooterPrimary).Range.Text = "Footer1 text"
endwith
with .ActiveDocument.Sections(2)
.Headers(wdHeaderFooterPrimary).Range.Text = "Header2 text"
.Footers(wdHeaderFooterPrimary).Range.Text = "Footer2 text"
endwith


>I am working on a large project involving word automation. Due to the lack of documentation of this concept, I am inching along. Maybe someone can help me with this.
>
>I wish to have various sections with different headers / footers in each.
>
>This code is an example of how I am attempting to do this. However, it is not working as expected. Even though I am setting the property LINKTOPREVIOUS as .F.
>
>Any ideas would be appreciated.
>
>
>
>oRange.InsertBreak(wdSectionBreakNextPage)
>
>* Begin Page 4
>* Introduction Letter
>oRange.Collapse(wdCollapseEnd)
>
>FOR j = 1 TO 5
> oRange.InsertAfter(CR)
>endfor
>oRange.InsertAfter(DTOC(DATE()))
>oRange.InsertAfter(CR+CR)
>oRange.InsertAfter("To the Management of ")
>oRange.Font.Name = FONT_NAME_STANDARD
>oRange.Font.Bold = 0
>oRange.Font.Italic = 0
>oRange.Font.Size = FONT_SIZE_STANDARD
>oRange.ParagraphFormat.Alignment = wdAlignParagraphLeft
>oRange.Collapse(wdCollapseEnd)
>
>* Here is where I attempt to change the text for this particular
>* section's header/footer. The Text I "Insert" becomes part of the
>* text that was in the previous section's header/footer.
>
>oHeader = oDoc.Sections.Last.Headers[WdHeaderFooterPrimary]
>oHeader.LinkToPrevious = .F.
>oHeader.Range.InsertAfter("New Header")
>
>oFooter = oDoc.Sections.Last.Footers[WdHeaderFooterPrimary]
>oFooter.LinkToPrevious = .F.
>oFooter.Range.InsertAfter("New Footer")
>
>oRange.Collapse(wdCollapseEnd)
>* End Page 4
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform