I want to set caption to my table:
var caption = new TableCaption();
caption.Val = "Test";
table.Append(caption);
But nothing happens. Whats wrong here?
UPADATE
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();
}
}
}
}
}
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…