创建TableCellProperties
并删除 后TableCellBorders
,word 文档变得不可读,我得到:
Word 在 test.docx 中发现不可读的内容。是否要恢复此文档的内容?如果您信任此文档的来源,请单击是。
我使用的代码:
TableCellProperties cellProp = new TableCellProperties(
new TableCellBorders(
new TopBorder()
{
Val =
new EnumValue<BorderValues>(BorderValues.Nil),
},
new BottomBorder()
{
Val =
new EnumValue<BorderValues>(BorderValues.Nil),
},
new LeftBorder()
{
Val =
new EnumValue<BorderValues>(BorderValues.Nil),
},
new RightBorder()
{
Val = new EnumValue<BorderValues>(BorderValues.Nil),
}
)
);
TableCell tc = new TableCell();
tc.Append(cellProp);
TableRow trTest = new TableRow();
trTest.Append(new TableCell(tc.OuterXml));
trTest.Append(new TableCell(new Paragraph(new Run(new Text("B")))));
trTest.Append(new TableCell(new Paragraph(new Run(new Text("C")))));
trTest.Append(new TableCell(new Paragraph(new Run(new Text("D")))));
trTest.Append(new TableCell(new Paragraph(new Run(new Text("E")))));
trTest.Append(new TableCell(new Paragraph(new Run(new Text("F")))));
t.Append(trTest);
BorderValue
设置为,Nil
因为None
似乎没有删除边框。在 MS Word 自动恢复过程之后,文件很好。什么会导致这样的问题?