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());
    }
}

也可以看看