What is the recommended strategy for in code to splice a set of MS Word documents together into one?
Cheers
Nik
What is the recommended strategy for in code to splice a set of MS Word documents together into one?
Cheers
Nik
http://www.codeproject.com/KB/aspnet/AppendWordDocuments.aspx
Or any of these: http://www.google.com/search?hl=en&q=append+microsoft+word+documents
Go look at the various SDKs available. This is much easier to do if you are using Word 2007, as the file is actually a zip file containing various XML documents. MS even has an SDK called "Open XML Format SDK 1.0" which provides strongly typed classes for working with the new office format.
If you are using Open XML (ie docx), there are 2 basic approaches to solving this problem:
The first is to do what is necessary so ids point to the correct relationship (eg for images, hyperlinks), and styles are defined etc. A good explanation of what you need to do can be found at http://blogs.msdn.com/ericwhite/archive/2009/02/05/move-insert-delete-paragraphs-in-word-processing-documents-using-the-open-xml-sdk.aspx
PowerTools implements that.
The second is to use altChunk: http://blogs.msdn.com/ericwhite/archive/2008/10/27/how-to-use-altchunk-for-document-assembly.aspx