Richtext bookmark is lost

I have a rich text:

  • [line1
  • line2
  • line3


When I use the insertDocument in aspose it shows like this:
[//one extra empty line is added by default

  • line1
  • line2
  • line3


and I have a bookmark between “[” “]” I need that bookmark, once I use builder.currentparagraph.remove() to delete the empty line the bookmark will be gone.
How can I maintain the bookmark?

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.

It would be great if you please share following detail for investigation purposes.

  • Please attach your input Word documents.
  • Please 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
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach your target Word document showing the desired behavior. You can use Microsoft Word to create your target Word document. I will investigate as to how you are expecting your final document be generated like.

Unfortunately, it is difficult to say what the problem is without the Document(s) and simplified application. We need your Document(s) and simple project to reproduce the problem. As soon as you get these pieces of information to us we’ll start our investigation into your issue.

Thank you

I attach the project, you can see the documents folder that contain the input, the template, the output of the project and the desiredoutput please check the code and let me know what to do to remove the starting extra line and maintain the bookmark ‘bookmark1’ I have aspose version

Rabih Zaylaa


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
    Public docReport As Document
    Public InputDoc As Document
    Public Builder As DocumentBuilder
    Public BuilderInputDoc As DocumentBuilder
    Sub Main()
        Dim lic = New License()
        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)
        Dim bmk = docReport.Range.Bookmarks("bookmark1")
        Builder.InsertDocument(InputDoc, ImportFormatMode.KeepSourceFormatting)
        If Not Builder.CurrentParagraph.NextSibling Is Nothing And Builder.CurrentParagraph.NextSibling.ToString(SaveFormat.Text).Trim() = "" Then
        End If
        docReport.Save(path & "\output.docx")
    End Sub
End Module

it works, thank you.

I don’t have the method InsertDocument of documentbuilder in my version, I used the sub insertdocument. can I know please for which version is added.

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.
Public API Changes in Aspose.Words 15.3.0

We suggest you please upgrade to the latest version of Aspose.Words for .NET 15.10.0 and let us know if you have any more queries.

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.
I have a question. does aspose have an editor I mean word processing editor. so we can open the document using aspose and edit the editable range.

Hi Rabih,

Thanks for your inquiry. Aspose.Words for .NET is a class library that enables your applications to perform a great range of document processing tasks. So, it does not offer any UI or web control for performing these document processing tasks on web page.

Our sister company offers a viewer app which you may consider including in your application to view the various file formats. With GroupDocs apps, you can also have limited editing functionalities. For more information, we suggest you please contact GroupDocs support through live chat or support forums of GroupDocs.

Please let us know if you have any more queries.

Thank you tahir for you assistance.
I looked into GroupdDocs, I will try this product and check if it suits our needs.


Hello Tahir,

I am still using apose version 14.6

Can I know what are the features of the newer version of aspose vs 14.6

Thank u

@rzeylah Could you please elaborate what features you are interested in? 14.6 version of Aspose.Words has been released about 10 years ago. There were a lot of fixes and improvements made since then. You can find the changes in our release notes:

About 120 new versions have been released since 14.6 version.

1 Like

Actually, Its working fine with me. I have had a lot of limitations but I always find solutions and workarounds.

I am wondering If my version can work with framework 6 or not.

@rzeylah I am afraid Aspose.Words 14.6 version does not support .NET6:

You can use Aspose.Words in .NET6 starting from 17.12 version. Starting from this version .NET Standard 2.0 version of Aspose.Words is provided. Since .NET6 is an implementation of .NET Standard 2.0, you can use 17.12 version with it. Bu I suggest you to update to the latest 24.2 version of Aspose.Words to get all new features and improvements we have made to the product.

1 Like