使用Open XML SDK为{.docx中的单元格设置样式

时间:2017-09-18 13:44:10

标签: c# wpf openxml-sdk

我在.docx文件中创建了一个表,并更改了对齐,字体等。 现在我通过C#生成新行,但它们不像上面的单元格那样具有相同的对齐,字体等。

如何为行设置类似.css文件的内容? 以下显示我的代码如何在表中添加一行:

TableRow tr = new TableRow();

TableCell positionCell = new TableCell();
positionCell.Append(new Paragraph(new Run(new Text(i.ToString()))));

TableCell bezeichnungCell = new TableCell();
descCell.Append(new Paragraph(new Run(new Text("Description"))));

tr.Append(positionCell);
tr.Append(descCell);
t.Append(tr);

此外,我无法使用xaml之类的positionCell.Alignment = Alignment.Center之类的东西。

0 个答案:

没有答案