I’ve encountered a business need to be able to insert a document into another document inline, rather than at the end of a paragraph/table. I’ve been working with the instructions provided here for inserting during a mail merge: http://www.aspose.com/docs/display/wordsjava/How+to++Insert+a+Document+into+another+Document
For example, if I have the following line in my parent document…
"I want to resolve these three sub-documents inline: <>, < and <>."
The result using the standard insertDocument method/instructions would be…
"I want to resolve these three sub-documents: , and .[subdoc1][subdoc2][subdoc3]"
because they are appended at the end of the paragraph the merge field is in.
I understand that insertAfter() will throw an “Cannot insert a node of this type at this location” error if the insert location node is not a paragraph or table. Is there a clever workaround that would make this possible? My hope would be to get this working with merge fields, but I’m all ears for any suggestions at this point.