I have a rich text:
- [line1
- line2
- line3
- line1
- line2
- line3
I have a rich text:
Hi Rabih,
Thanks for your inquiry. Please note that DocumentBuilder.InsertDocument method mimics the MS Word behavior, as if CTRL+‘A’ (select all content) was pressed, then CTRL+‘C’ (copy selected into the buffer) inside one document and then CTRL+‘V’ (insert content from the buffer) inside another document.
create a standalone/runnable simple application (for example a Console
Application Project) that demonstrates the code (Aspose.Words code) you used to generate
your output document
Hi Rabih,
Thanks for sharing the document. Please use following code example to achieve your requirements. Hope this helps you. Please let us know if you have any more queries.
Module Module1<o:p></o:p>
Public docReport As Document
Public InputDoc As Document
Public Builder As DocumentBuilder
Public BuilderInputDoc As DocumentBuilder
Sub Main()
Dim lic = New License()
lic.SetLicense("Aspose.Total.lic")
Dim path = IO.Path.Combine(IO.Path.GetDirectoryName(Application.ExecutablePath), "..\..\documents")
docReport = New Document(path & "\template1.docx")
InputDoc = New Document(path & "\input.docx")
Builder = New DocumentBuilder(docReport)
BuilderInputDoc = New DocumentBuilder(InputDoc)
BuilderInputDoc.MoveToDocumentEnd()
BuilderInputDoc.StartBookmark("bm_end")
BuilderInputDoc.EndBookmark("bm_end")
Dim bmk = docReport.Range.Bookmarks("bookmark1")
Builder.MoveTo(bmk.BookmarkStart)
Builder.InsertDocument(InputDoc, ImportFormatMode.KeepSourceFormatting)
Builder.MoveToBookmark("bm_end")
If Not Builder.CurrentParagraph.NextSibling Is Nothing And Builder.CurrentParagraph.NextSibling.ToString(SaveFormat.Text).Trim() = "" Then
Builder.CurrentParagraph.NextSibling.Remove()
End If
docReport.Save(path & "\output.docx")
End Sub
End Module
it works, thank you.
Hi Rabih,
Thanks for your inquiry. The DocumentBuilder.InsertDocument method was introduced in Aspose.Words v15.3.0. Please check the public API changes from following link.
Thank you. I will try to update to the latest version. I also found that adding new editable ranges is now supported with that version which is good.
Hi Rabih,
Thank you tahir for you assistance.