public static void AddTableFrame() { WordDocument document = new WordDocument(); WordDocumentBuilder builder = new WordDocumentBuilder(document); builder.TableState.Indent = 100; builder.TableState.PreferredWidth = new TableWidthUnit(300); builder.TableState.LayoutType = TableLayoutType.FixedWidth; Paragraph tableTitle = builder.InsertParagraph(); tableTitle.TextAlignment = Alignment.Center; builder.InsertLine("Table Frame"); Table table = builder.InsertTable(); table = CreateTableFrame(table); WordFile wordFile = new WordFile(); using (var stream = File.OpenWrite("AddTableFrame.docx")) { wordFile.Export(document, stream); } }
public static void AddSimpleTable() { WordDocument document = new WordDocument(); WordDocumentBuilder builder = new WordDocumentBuilder(document); builder.TableState.Indent = 100; Paragraph tableTitle = builder.InsertParagraph(); tableTitle.TextAlignment = Alignment.Center; builder.InsertLine("Simple Table Title"); Table table = builder.InsertTable(); table = CreateSimpleTable(table); WordFile wordFile = new WordFile(); using (var stream = File.OpenWrite("AddSimpleTable.docx")) { wordFile.Export(document, stream); } }