Hello,
I have been following the tutorial at
http://openxmldeveloper.org/blog/b/openxmldeveloper/archive/2011/09/23/advanced-use-of-documentbuilder-2-0.aspx
If I attempt to use this technique to populate a content control that is within a body of text, the document builder seems to ignore this. For example, if my document was layed out like:
Hello, this is a test [Content control] paragraph.
It will not even look at that content control during insertion. I am seeing that content controls that are on separate lines are just fine, and this is limited to just content controls within bodies of text. Is there any way for me to insert another document within a content control that is in a body of text?
Hi,
This is not a supported scenario. DocumentBuilder works at the block-level of content, not run level. When inserting content using DocumentBuilder, you are inserting either paragraphs or tables. You are not inserting runs. It is not valid to insert a paragraph or a table in a run-level content control.
If you need to programmatically insert run-level content in the way that you describe, one possible approach is to take the content at the paragraph level, insert the run-level content, and fabricate a new document. You then could use DocumentBuilder to insert the newly fabricated document into another document.
-Eric