Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combining multiple word documents into one
Message
De
06/04/2004 12:16:10
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
06/04/2004 12:02:50
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00892459
Message ID:
00892658
Vues:
10
>Well, I'm 'close', but at the end my page count gets recalced, and I don't want it to...
>
>I tried Cetin's code, but because I have section formatting that I have to reset, I did the following...
>
>oWord = CREATEOBJECT('Word.Application')
>oWord.WordBasic.Fileopen('c:\blank.doc')
>DIMENSION aDocs[4]
>STORE 'C:\TEST1.DOC' TO aDocs[1] && has "page 1 of 3"
>STORE 'C:\TEST2.DOC' TO aDocs[2] && has "page 1 of 2"
>STORE 'C:\TEST3.DOC' TO aDocs[3] && has "page 1 of 9"
>STORE 'C:\TEST4.DOC' TO aDocs[4] && has "page 1 of 7"
>
>
>oWord.Selection.InsertFile(aDocs[1])
>
>FOR nCounter = 2 TO 4
> oWord.WordBasic.EndOfDocument(0) && go to the end
> oWord.Selection.InsertBreak(2) && insert new section break
> oWord.Selection.PageSetup.TextColumns.SetCount(1) && back to 1 column
> WITH oWord.Selection.Sections(1).Footers(1)
> .PageNumbers.RestartNumberingAtSection = .t.
> .PageNumbers.StartingNumber = 1
> ENDWITH
> oWord.Selection.InsertFile(aDocs[nCounter])
>ENDFOR
>oWord.Visible = .t.
>
>Now, this works...except that once I have my big document at the end, the first time I do a page preview or a print, it 'renumbers' the total page count...so the first page of document #3 now says 'Page 1 of 17', instead of 'Page 1 of 9'. I need a way to tell MS word, "don't recalc the page count". Any ideas?
>
>Thanks for your help,
>Kevin

May I jump in. Have you tried master document way ? With master document way it did nicely for me (tested this time:). What I did was :
Created a master document
Within master document view (outline) simply entered empty text for headings (pressed enter 3 times for 3 docs)
Inserted section breaks for each. Set page numbering to start from 1 for each section.
Inserted bookmarks at each section (doc1,doc2,doc3) and saved as mastertemplate.doc.
Then ran the code I sent (master one). It paginated per section.
PS: Also formatting for each doc was as it was in original doc.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform