Sambatyon
Sambatyon

Reputation: 3374

Appending different word documents keeping the attributes of each document

I have an application which generates different kinds of reports. Now the client wants to add an option where all the reports are generated simultaneously one after the other in a single document. I've been trying to do this, particularly inserting an file as an object but the footers and headers are lost.

I have seen many applications which claim to achieve my goal but I am not allowed to buy a license and they cannot be used programatically. Is there any way to achieve this?

Upvotes: 0

Views: 327

Answers (1)

DarinH
DarinH

Reputation: 4879

The hard way, that's the only method I've found.

Basically, you have to:

1) Open the file to be inserted

2) use Doc.INSERTFILE to insert the file at the required spot in the main doc. Make note of the location of the insertion, the active section etc.

3) now loop through all the sections of the file being inserted, and copy over everything about those sections to the new sections in the main doc, including header footer info, formatting, page layout etc.

It's a pain, but as far as I can tell, there is no other easier way to get there.

Upvotes: 1

Related Questions