Skip to content

ES-942135-How to set same table style for all newly inserted tables in a Word document#525

Open
GOPINATH-SF4767 wants to merge 2 commits into
mainfrom
ES-942135-Table
Open

ES-942135-How to set same table style for all newly inserted tables in a Word document#525
GOPINATH-SF4767 wants to merge 2 commits into
mainfrom
ES-942135-Table

Conversation

@GOPINATH-SF4767

Copy link
Copy Markdown
Collaborator

Description:
Added sample to set same table style for all newly inserted tables in a Word document

static void Main(string[] args)
{
// Open an existing word document
using (FileStream inputFileStream = new FileStream(Path.GetFullPath(@"Data/Template.docx"), FileMode.Open))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why using stream, open directly


// Append table manually - this one applies the table style from the template
WTable table = resultDocument.LastSection.AddTable() as WTable;
WTableRow row = table.AddRow();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify code by AppendTable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants