We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Inserting a Document into another document in-line

Hi,


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.

Thanks,

John

Hi John,


Thanks for your inquiry. Please attach the following resources here for testing:

  1. Template document
  2. Sub-document 1
  3. Sub-document 2
  4. Sub-document 3
  5. Expected document

You can create your target/expected document using Microsoft Word; we just want to visualize the final output. We will then investigate this scenario further and provide you more information.

Best regards,