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

Free Support Forum - aspose.com

Insert HTML and merge Word Documents


I have a Word template that I need to insert HTML from a database and also merge existing Word documents into this template. They need to go in a certain order as well. My problem is that I insert some HTML, merge a Word file and then insert some more HTML but things get out of order. The resulting Word document has the HTML from the first insert followed by the HTML from the third step and then the merged Word document is at the end of the file. Any suggestions would be much appreciated.

When I insert HTML, I use this code:


And I use this function to merge a Word document:

Public Shared Sub MergeDocs(ByVal sourceDoc As Aspose.Words.Document, ByRef destDoc As Aspose.Words.Document)
For Each sect As Aspose.Words.Section In sourceDoc.Sections
If sect.Equals(sourceDoc.FirstSection) Then
sect.PageSetup.SectionStart = SectionStart.Continuous
End If
Dim newSection As Aspose.Words.Section = destDoc.ImportNode(sect, True, ImportFormatMode.KeepSourceFormatting)
End Sub

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

Thanks for your inquiry. I think you can use builder.MoveToDocumentEnd() after appending a document and before inserting the second portion of HTML.

Hope this helps.

Best regards.

That worked. Thanks.