IsLastRow
Row.IsLastRow property
如果这是表中的最后一行,则为 True;否则为 false。
public bool IsLastRow { get; }
例子
展示如何设置表格以保持在同一页面上。
Document doc = new Document(MyDir + "Table spanning two pages.docx");
Table table = doc.FirstSection.Body.Tables[0];
// 为表格中的每个段落启用 KeepWithNext,除了
// 最后一行的最后一个将防止表格分裂到多个页面上。
foreach (Cell cell in table.GetChildNodes(NodeType.Cell, true))
foreach (Paragraph para in cell.Paragraphs)
{
Assert.True(para.IsInCell);
if (!(cell.ParentRow.IsLastRow && para.IsEndOfCell))
para.ParagraphFormat.KeepWithNext = true;
}
doc.Save(ArtifactsDir + "Table.KeepTableTogether.docx");
也可以看看
- class Row
- 命名空间 Aspose.Words.Tables
- 部件 Aspose.Words