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

How to modify run properties with DOCIO

I am attempting to modify an existing Word document.  In it, I have a table with a single row, and I need to add more rows that match.  The initial row has an empty paragraph in each cell.  Looking at the OOXML, here is the existing paragraph:



When I try to add a new row, and a new paragraph in the cells, this is what I get:

 Is there a way I can modify the inner run properties element (or, better yet, set a default

2 Replies 1 reply marked as answer

JB Joe Baker March 2, 2023 01:39 PM UTC

In case anyone is ever in the same boat, the BreakCharacterFormat on the WParagraph object is what I nee


Marked as answer

SB Suriya Balamurugan Syncfusion Team March 2, 2023 05:25 PM UTC

Hi Joe,

Yes, you can set the BreakCharacterFormat to set the run properties of the paragraph.

Regarding - I have a table with a single row, and I need to add more rows that match:
To achieve your requirement, we suggest you to clone the row and add the cloned row into the table as per the below code snippet. So that you can add rows that match with existing.

//Get the table from a Word document.

WTable table = wordDocument.Sections[0].Tables[0] as WTable;

//Clone the row.

WTableRow row = table.Rows[0].Clone();

//Add the cloned row into the table.

table.Rows.Add(row);


Refer our documentations to know more about working with table in Word document,
https://help.syncfusion.com/file-formats/docio/working-with-tables
https://www.syncfusion.com/kb/13626/how-to-insert-a-row-with-the-same-formatting-in-a-word-document

Regards,
Suriya Balamurugan.

Note: If this post is helpful, please consider accepting it as the solution so that other members can locate it more quickly.


Loader.
Live Chat Icon For mobile
Up arrow icon