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.
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.
Please find attached ZIP File with
- Program.cs ( that uses the ExtractContent Code)
- ExpectedOutput.docx( The content that is inside the bookmark)
- ActualOutput.docx ( The content that is getting extracted by the code)
- _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)
- _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
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.
Is there an update to this issue?
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.
That fix worked well for us