Combine Documents

I am trying to combine two docx documents into one docx document using OpenXML SDK 2.0. Documents should be combined without losing style and custom headers and footers. I hope I can achieve this using AltChunksection break. But I can’t make it work.

Is it possible that I'm trying to do? Can someone give me a hint how to do this?

+5
source share
2 answers

Using the "Open XML Performance Tool", I analyzed the structure of the docx document and came to the conclusion that merging documents with their style, headers, footers ... is impossible from the box using Altchunk. You can download the tool separately from open xml sdk .

What I am doing now and what works is copying everything manually into a document, making sure that all style links, link headers, footers ... are saved. This means that I give them a new unique identifier before copying them into a document and changing all links from the old identifier to the new one. There is a lot of code for this, but the tool mentioned above really helped.

. , SectionProperties -tag SectionProperties -tag Body -tag, . , , SectionProperties -tag SectionProperties -tag Body -tag. .

+1

! , AltChunk , !

. . UNTIL Word (, .)

, , . : https://blogs.msdn.com/b/ericwhite/archive/2008/10/27/how-to-use-altchunk-for-document-assembly.aspx?Redirected=true

p.s. Open XML , , Visual Studio Open XML Office Documents Visual Studio, , !: -)

+4

All Articles