I guess I have 2 questions:
1. In thedocumentation on msdn referring to Openxml and Word 2007, I noticed that there was a schema for the relationship cfChunk. Does that mean that I can use the 2003 cfChunk in Office 2007?
2. I have tried to use altChunk to add an rtf file into my .docx by manipulating the xml file I added the necessary relationship, the content type, and the code in document.xml, but the file opens as corrupt. Does altChunk not work in Microsoft Office Enterprise 2007?
I really need a way to add a .docx into another .docx file and I have tried just about everything I have found in the forums.
Hi thanks for the code snippet for the OpenXml sdk v2.0
I have an unanswered question I was wondering at the bottom of the code
where you have :
//Insert the altChunk tag just before content controlsdtBlock.InsertBeforeSelf(altChunk);
How can I just insert the altChunk at the bottom of the .docx or what is sdtBlock?
vmoss: Hi thanks for the code snippet for the OpenXml sdk v2.0 I have an unanswered question I was wondering at the bottom of the code where you have : //Insert the altChunk tag just before content controlsdtBlock.InsertBeforeSelf(altChunk); How can I just insert the altChunk at the bottom of the .docx or what is sdtBlock?
IT WORKED!!!!!!!!!!! That's one headache out of the window!
Thank you very much vj9999.
Thanks for the code snippet. It really helped out a lot. There is one other issue involved here. Some parts of the merged(second) document are reformatted using the style of the first document, particularly the bulleting & numbering. I tried to fix this using quite a few options. Couple of these are mentioned below, Snippet 1 - DocumentFormat.OpenXml.Wordprocessing.Locked locked1 = doc.MainDocumentPart.StyleDefinitionsPart.Styles.Descendants<Locked>().Last(); locked1.Val = BooleanValues.False; doc.MainDocumentPart.Document.Save(); Snippet 2 - AltChunkProperties properties = new AltChunkProperties(); altChunk.AltChunkProperties = properties; MatchSource matchSource = new MatchSource(); matchSource.Val = BooleanValues.True; altChunk.AltChunkProperties.MatchSource = matchSource; None of these options work. Are there any other properties which need to be set apart from the ones mentioned above? Any help on this is highly appreciated. Thanks, Anand.