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

Free Support Forum - aspose.com

Inserting formatted Text (merging documents)

Hello,

I am trying to convert our Office Automation application to Aspose (Words for .Net), and run into the functionality where we used to inject formatted text from one document into another at the place of a Mergefield. (via Range.FormattedText)

As Aspose Words does not have such a property (as it is node based) I tried to copy over Nodes from the source document. However, I run into the error that the node types I try insert are not allowed at that location. (the mergefield can be in the middle of a paragraph, or more commonly, in a cell in a table.)

I noticed an old post that seems to refer to what I need, but it contained a dead link:
http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/insert-a-document-into-another-document.html

So, can you please inform me how I can copy over the formatted content?

I currently have (not working):
builder.MoveToField(myField, True)
For Each subsection As Aspose.Words.Section In embedBlockDoc.Sections
Dim clone As Aspose.Words.Node = subsection .Clone(True)
clone = e.Document.ImportNode(clone, True)
builder.InsertNode(clone)
Next

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. This article was moved here:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/howto-insert-a-document-into-another-document.html

I think it could help you to achieve what you need.

Best regards.

Thank you, that indeed helped me to do exactly what I hoped for.