开发者

Merging multiple MS Word documents already saved in one docx file with OpenXML

I did the merging multiple documents into one singe document (Test.docx) with FeedData and it works fine.

When I open the merged document Test.docx with WinZip, content looks like this:

File1.docx, File2.docx, File3.docx, where all merged documents are being stored like external files into Test.docx file.

Now wondering if there are possibility to be created one single document Test.docx with whole content inside instead of multiple files开发者_运维技巧 to be stored as it noted above, this will helps me a lot when I'm making Search / Replace content since like this, we opening file by file procedure?

Note: If I open the Test.docx via MS Word and press "Save", MS Word do the job but I would like to produce the same result via code?

Thank you in advance.

Best Tod


Take a look at this article, and see if this is what you're looking for:

http://blogs.msdn.com/b/brian_jones/archive/2008/12/08/the-easy-way-to-assemble-multiple-word-documents.aspx


Another way to merge multiple Open XML DOCX files into a single file is using the DocumentBuilder module that is part of Open-Xml-PowerTools, which is an open source lib on github.

https://github.com/OfficeDev/Open-Xml-PowerTools

more info about DocumentBuilder: http://openxmldeveloper.org/wiki/w/wiki/documentbuilder.aspx

Given that you want to do search and replace, check out OpenXmlRegex, also part of Open-Xml-PowerTools:

http://openxmldeveloper.org/blog/b/openxmldeveloper/archive/2014/07/22/search-and-replace-content-in-docx-pptx-using-regular-expressions.aspx

All open source, all free (both as in beer and speech).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜