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.
https://i.imgur.com/xjzh2do.png
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