Join MS Word documents

2019-04-16 11:38发布

What is the recommended strategy for in code to splice a set of MS Word documents together into one?

Cheers

Nik

3条回答
狗以群分
2楼-- · 2019-04-16 12:09

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

查看更多
男人必须洒脱
4楼-- · 2019-04-16 12:27

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.

查看更多
登录 后发表回答