WITH .activedocument.content > .insertafter("Ref.: " + lcrefno) > ENDWITH > > .SELECTION.EndKey(wdStory) > > WITH .SELECTION.RANGE > .style = 0 > .style = 1 > .style = 2 > .style = 3 > .style = 4 > .style = 5 > .style = 6 > .style = 7 > .style = 8 > .style = 9 > .style = 10 > ENDWITH>
>>crlf = CHR(13)+CHR(10) >> >>wdStory=6 >>wdExtend =1 >>wdSectionBreakNextPage=2 >>wdHeaderFooterPrimary=1 >>Wdheaderfooterfirstpage=2 >> >>oWord = CREATEOBJECT("Word.Application") >> >>with oWord >> .documents.ADD() >> .visible=.t. >> >> with .activedocument.content >> .insertafter("Test procedure:"+crlf+crlf) >> endwith >> >> .Selection.EndKey(wdStory) >> >> with .activedocument.content >> .insertafter("Text Line1 Font Bold Red Courier New " +crlf) >> endwith >> .Selection.EndKey(wdStory, wdExtend) >> WITH .Selection.Range.Font >> .NAME = "Courier New" >> .bold = .T. >> .color=RGB(255,0,0) >> ENDWITH >> >> .Selection.EndKey(wdStory) >> >>* start another section, needed only to use different footer-headers in the future >> .Selection.InsertBreak(wdSectionBreakNextPage) >> >> .Selection.EndKey(wdStory) >> >> with .activedocument.content >> .insertafter("Text Line2 Font Green Times New Roman " +crlf) >> endwith >> .Selection.EndKey(wdStory, wdExtend) >> WITH .Selection.Range.Font >> .NAME = "Times New Roman" >> .bold = .f. >> .color=RGB(0,255,0) >> ENDWITH >> .Selection.EndKey(wdStory) >> >> .Selection.EndKey(wdStory) >> >>* HEADER FOOTER >> .ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = .f. >> >> with .ActiveDocument.Sections(1) >> .Headers(wdHeaderFooterPrimary).Range.Text = "1Header text" >> .Footers(wdHeaderFooterPrimary).Range.Text = "1Footer text" >> endwith >> >> with .ActiveDocument.Sections(2) >> .Headers(wdHeaderFooterPrimary).LinkToPrevious = .f. >> .Footers(wdHeaderFooterPrimary).LinkToPrevious = .f. >> .Headers(wdHeaderFooterPrimary).Range.Text = "2Header text" >> .Footers(wdHeaderFooterPrimary).Range.Text = "2Footer text" >> .Footers(wdHeaderFooterPrimary).Range.Font.Color=RGB(100,200,50) >> >> endwith >> >> .activedocument.SAVEAS("c:\myword.doc") >> .activedocument.CLOSE >>endwith >> >>oWord.QUIT() >>oWord=.null. >>release oWord >>>>>