Reading content between Bookmarks not working in latest verison of Aspose.Words ( .NET )

Using the ExtractContent code provided in the following help

I tried to read the content inside the following bookmark in the attached document

string bookmarkId = "_a8fcf8ef_1ada_4523_a6f6_2a7663539ef6";

The code does not return the content wrapped by the bookmark

The code relies on getting currNode.NextSibling but when I debug to see what the problem is it looks like a bookmarkNode seems to return the next bookmark node rather than the paragraphNode that follows it.

Any help to overcome this issue will be appriciated.

Hi there

Thanks for your inquiry. We have tested the scenario using code from following documentation link and we are unable to notice any issue. We will appreciate it if you please share some more details of issue(error) you are facing and a sample expected output document. It will help us to understand your issue and address it accordingly.

We are sorry for the inconvenience.

Best Regards,

Please find attached ZIP File with

  1. Program.cs ( that uses the ExtractContent Code)
  2. ExpectedOutput.docx( The content that is inside the bookmark)
  3. ActualOutput.docx ( The content that is getting extracted by the code)
  4. _a8fcf8ef_1ada_4523_a6f6_2a7663539ef6.txt ( The text content of the Bookmark - this seems to have the correct data , but since it is text content only without any formatting , it is not very useful for us. I am including this toshow that the bookmark object seems to be correct)
  5. _a8fcf8ef_1ada_4523_a6f6_2a7663539ef6.html - This is just the html output that matches the ActualOutput.docx)

The bookmark is a hidden bookmark so , if you use Word to view the document, you might have to click on the show hidden check box to see all the bookmarks

Let me know if you need anything else to reproduce the issue

Hi Srikanth,

Thanks for sharing additional information. I am able to extract the contents but it is not retaining the formatting. I am further investigating the issue and will update you accordingly.

Best Regards,

Is there an update to this issue?

Hi Srikanth,

Thanks for your patience. Please note if BookmarkStart node is inside the cell of the Table, then your shared code does not extract Table node. Please find attached sample code, we have slightly changed it for your requirements. It will help you to accomplish the task.

Best Regards,

Thank You
That fix worked well for us