Hi,
I’m trying to create a table within a new Word document and retain proper style association to allow the user to download the created document and then easily make manual modifications with MS Word.
I want to apply a modified native Table Style to a table:
builder.EndTable();
table.StyleIdentifier = StyleIdentifier.GridTable6ColorfulAccent3;
table.StyleOptions = TableStyleOptions.RowBands | TableStyleOptions.FirstColumn | TableStyleOptions.FirstRow;
Basically, I’d to know how to access and modify those MS word options (see attachment).
image.png (23.6 KB)
I tried to access the TableStyle
using the following code but cannot seem to have access to the options from the image.
style = builder.Document.Styles[StyleIdentifier.GridTable6ColorfulAccent3];
var tblStyle = style as TableStyle;
// tblStyle.HeaderRow.Font.Color = ...
I am aware of the function doc.ExpandTableStylesToDirectFormatting();
but I cannot use that because that would mean that each table style would become local table cell styling. So, if I had, say 5 tables, and wanted to later manually modify the header row shading and font color from MS Word, I would have to individually edit each of those 5 tables instead of just editing the “Grid Table 6 Colorful Accent 3” style.
Can you help? Is that supported? If not, will it be? This is pretty important to create clean Word documents.
Thanks.
p.s. Creating a new Table Style from scratch would also be OK, but more work then modifying a native style.
Somewhat related posts (though different):