PreviousCell

Cell.PreviousCell property

获取上一个Cell节点.

public Cell PreviousCell { get; }

评论

当您需要对单元格进行类型访问时,可以使用该方法Row 如果 a StructuredDocumentTag节点位于一行而不是一个单元格中,则会自动遍历以获取其中包含的单元格。

例子

展示如何枚举所有表格单元格。

Document doc = new Document(MyDir + "Tables.docx");
Table table = doc.FirstSection.Body.Tables[0];

// 枚举表格的所有单元格。
for (Row row = table.FirstRow; row != null; row = row.NextRow)
{
    for (Cell cell = row.FirstCell; cell != null; cell = cell.NextCell)
    {
        Console.WriteLine(cell.GetText());
    }
}

也可以看看