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

Free Support Forum - aspose.com

Bug around bookmark text values

AsposeBookmarkIssue.zip (6.1 KB)

We are using Aspose.Words 18.12 and we have a problem with some bookmark text values.

After creating Aspose.Words.Document based on attached file, there is added \u0014 character code to the end of bookmark text field for some bookmarks.

We would expect that bookmark text is without this character \u0014

Is it an issue or this code is added for some reason? Is there any workaround?

Thank you in advance and best regards,
Pawel Musial


You are facing the expected behavior of Aspose.Words. There is field separator between the BookmarkStart and BookmarkEnd nodes. You can check it in document.xml by unzipping your document. Please check the attached screenshot of DOM for field separator.

The Bookmark.Text property returns string value. You can remove \u0014 from the text as shown below.

Document doc = new Document(MyDir + "AsposeBookmarkIssue.doc");
foreach (Bookmark bookmark in doc.Range.Bookmarks)
    if (bookmark.Text.Contains("\u0014"))
        Console.WriteLine(bookmark.Text.Replace("\u0014", ""));

Hello @tahir.manzoor, thank you for for reply.
That of course make sense. We were not aware about them ‘FieldSeparator’ s.
Are you able to tell us what kind of software you are using that can display document structure like that?
That would be very helpful in the future!

Thank you in advance and best regards,
Pawel Musial


I used “Document Explorer” project to view document’s nodes. Please get the code of this project in Aspose.Words for .NET examples repository at GitHub.