Novacode DocX 在 C# 中修复了 Table 大小
Novacode DocX Fixed Table Size in C#
如何在 C# 中获得固定的 table 大小?就像我添加项目时一样,仍然与模板大小相同,但列可以自动调整。谢谢!
我的代码:
Table tbl2 = doc.AddTable(15, 5);
tbl2.AutoFit = AutoFit.Contents;
tbl2.Alignment = Alignment.center;
tbl2.Rows[0].Cells[0].Paragraphs.First().Append("QUANITY").Bold().Font(new System.Drawing.FontFamily("Calibri")).Alignment = Alignment.center;
tbl2.Rows[0].Cells[1].Paragraphs.First().Append("UNIT").Bold().Font(new System.Drawing.FontFamily("Calibri")).Alignment = Alignment.center;
tbl2.Rows[0].Cells[2].Paragraphs.First().Append("DESCRIPTION").Bold().Font(new System.Drawing.FontFamily("Calibri")).Alignment = Alignment.center;
tbl2.Rows[0].Cells[3].Paragraphs.First().Append("UNIT PRICE").Bold().Font(new System.Drawing.FontFamily("Calibri")).Alignment = Alignment.center;
tbl2.Rows[0].Cells[4].Paragraphs.First().Append("TOTAL").Bold().Font(new System.Drawing.FontFamily("Calibri")).Alignment = Alignment.center;
P.S.: 有没有教Novacode DocX的视频教程,可以给我link吗?真的帮了我们很多!谢谢!
如果你想固定单元格的大小,你需要这样做。
Table signOfftbl = doc.AddTable(4, 2);
signOfftbl.Design = TableDesign.TableGrid;
signOfftbl.Rows[0].Cells[0].Paragraphs.First().AppendLine("");
signOfftbl.Rows[0].Cells[0].Width = 50m;
signOfftbl.Rows[0].Cells[1].Paragraphs.First().AppendLine("Accept advice and action recommendations");
signOfftbl.Rows[0].Cells[0].Width = 900m;
如何在 C# 中获得固定的 table 大小?就像我添加项目时一样,仍然与模板大小相同,但列可以自动调整。谢谢!
我的代码:
Table tbl2 = doc.AddTable(15, 5);
tbl2.AutoFit = AutoFit.Contents;
tbl2.Alignment = Alignment.center;
tbl2.Rows[0].Cells[0].Paragraphs.First().Append("QUANITY").Bold().Font(new System.Drawing.FontFamily("Calibri")).Alignment = Alignment.center;
tbl2.Rows[0].Cells[1].Paragraphs.First().Append("UNIT").Bold().Font(new System.Drawing.FontFamily("Calibri")).Alignment = Alignment.center;
tbl2.Rows[0].Cells[2].Paragraphs.First().Append("DESCRIPTION").Bold().Font(new System.Drawing.FontFamily("Calibri")).Alignment = Alignment.center;
tbl2.Rows[0].Cells[3].Paragraphs.First().Append("UNIT PRICE").Bold().Font(new System.Drawing.FontFamily("Calibri")).Alignment = Alignment.center;
tbl2.Rows[0].Cells[4].Paragraphs.First().Append("TOTAL").Bold().Font(new System.Drawing.FontFamily("Calibri")).Alignment = Alignment.center;
P.S.: 有没有教Novacode DocX的视频教程,可以给我link吗?真的帮了我们很多!谢谢!
如果你想固定单元格的大小,你需要这样做。
Table signOfftbl = doc.AddTable(4, 2);
signOfftbl.Design = TableDesign.TableGrid;
signOfftbl.Rows[0].Cells[0].Paragraphs.First().AppendLine("");
signOfftbl.Rows[0].Cells[0].Width = 50m;
signOfftbl.Rows[0].Cells[1].Paragraphs.First().AppendLine("Accept advice and action recommendations");
signOfftbl.Rows[0].Cells[0].Width = 900m;