tags:

views:

251

answers:

1

I have a need to gather a number of .docx files in a folder and "chain" them into a single document that will be displayed to the user.

Now I've read Brian Jones' article but while it sounded promising I have encountered a problem.

When I perform the actions manually using Word 2007 I end up with a copy of the docx file in the /embeddings folder and when I open the document I am presented with the embedded content.

However, when I do the same thing through code I end up with a file called package.bin in the /embeddings folder and when I open the document I'm greeted with the alternate image telling me to Double-Click on it to activate the embedded document. This is not what I wanted.

Can someone clarify how I embed the document(s) so that they appear as .docx files rather than .bin? I'm hoping that this will overcome the Double-Click to Activate issue as well.

Thanks in Advance

A: 

I posted this question on the OpenXMLDeveloper forums and was directed to another article by Brian Jones.

While the blog pointed me in the right direction it was not a magic bullet. I had issues with formatting that were resolved by adding a MatchSource element to the AltChunk;

MatchSource matchSrc = new MatchSource();
matchSrc.Val = DocumentFormat.OpenXml.Wordprocessing.BooleanValues.True;
altChunk.AppendChild(matchSrc);

I also needed to remove the footer from the documents being merged as they were being replicated in the new document (resulting in numerous footers within the main footer!). Now I just have the footer in the template for the master document.

Hope this helps someone else as there doesn't seem to be too much information out there are the moment.

DilbertDave