We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

WordDocument accessing table via bookmark

Hello. I'm trying to access the table in a Word document by bookmark. I can access it just fine but when I change some text in a table or try to add rows, there is no change visible in the saved document. I'm attaching the code which accesses the table.

3 Replies

VR Vijay Ramachandran Syncfusion Team August 7, 2017 08:48 AM UTC

Hi Tim,

Thank you for contacting Syncfusion support.

On analyzing further with the given details, we found that you have used GetBookmarkContent() method to get the particular bookmark text body. Then you have finds the table and added the text into each cell of this table.

Since the GetBookmarkContent() method is used to get the bookmark content as cloned text body, the changes made in the cloned text body wasn’t reflected in original Word document. If your requirement is changing the Word document content means, then kindly replace the existing text body with new text body(text added to each cell) by using our BookmarksNavigator.ReplaceBookmarkContent() API. Kindly add the below highlighted code in your sample to resolve the reported problem.
    var part = bookmarkNavigator.GetBookmarkContent();
if(part.BodyItems.FirstItem is IWTable table)
foreach(WTableRow row in table.Rows)
foreach (WTableCell cell in row.Cells)
foreach (WParagraph paragraph in cell.Paragraphs)
                    paragraph.Text =


We have also prepared demo sample for this scenario, please find the sample from here and let us know if it helps.

Vijay R

TI Tim August 10, 2017 09:37 AM UTC

It works now. Thanks for your help.

SY Sethumanikkam Yogendran Syncfusion Team August 10, 2017 09:49 AM UTC

Hi Tim,

Thank you for your update.

We are happy to hear that the provided sample resolved your requirement. Please let us know if you need any further assistance on this. We will be happy to assist you as always.

Please let us know if you have any other questions.


Live Chat Icon For mobile
Up arrow icon