我想标题设置为我的表:
var caption = new TableCaption();
caption.Val = "Test";
table.Append(caption);
但没有任何反应。 请告诉我错在这里?
下降
foreach (var tabl in mainPart.Document.Body.Descendants<Table>())
{
foreach (var trow in tabl.Elements<TableRow>())
{
foreach (var tcell in trow.Elements<TableCell>())
{
foreach (var para in tcell.Elements<Paragraph>())
{
foreach (var run in para.Elements<Run>())
{
foreach (var text in run.Elements<Text>())
{
if (
text.Text ==
"my caption")
{
para.RemoveAllChildren();
para.Remove();
}
}
}
}
}
}
}