Page 1 of 1

Best method for replacing content control with a word doc

PostPosted: Sat Jun 16, 2012 12:28 am
by jallen
I have read everything I can find on the forum about inserting word documents into other word documents. I have also gone through the samples and readme in the MergeDocx extension. I am not exactly sure the best method for accomplishing this, and was hoping you could point me in the right direction.

I am looking to replace a content control in my main document with another word document. After looking at the MergeDocx extension, it appears that the only method is to use an altChunk and then use MergeDocx to process the chunks into the main document. Is this the best way to accomplish this?

Just to spell out exactly what I am doing. I am basically meging field data into a form letter template. I have the basic merge working now using content controls and xml data binding. The complicated part is that some merge fields can be defined as "segments", which are actually other word documents. These segments can also contain merge fields as content controls. The segments need to be first inserted into the main document, then reprocess the new combined document for merge fields and create the data bindings. I hope that made sense.

Re: Best method for replacing content control with a word do

PostPosted: Wed Jun 20, 2012 10:48 pm
by jason
I'm not sure whether you are using plain vanilla content control data binding, or the OpenDoPE extensions.

The OpenDoPE extensions support a concept of component (an sdt with something like <w:tag w:val="od:component=comp1"/>), which is content control which is replaced with an altChunk, or, for a MergeDocx user, real WordML. So it sounds similar to your "segment" concept.

That should do what you want.

If you don't want to use od:component for some reason, then you have a couple of alternatives.

Alternative 1 is as you describe, that is get your segment as an AltChunk and process that (either using MergeDocx or your own code).

Alternative 2 is to merge the segment directly into your docx, skipping the altChunk step. You can use MergeDocx to do this, or you can write your own code (how much is involved will depend on the sort of content you have in your segments - MergeDocx aims to cover all cases)

Hope this helps...