previous_cell property

Cell.previous_cell property

Gets the previous Cell node.

@property
def previous_cell(self) -> aspose.words.tables.Cell:
    ...

Remarks

The method can be used when you need to have typed access to cells of a Row. If a StructuredDocumentTag node is found in a row instead of a cell, it is automatically traversed to get a cell contained within.

Examples

Shows how to enumerate through all table cells.

doc = aw.Document(file_name=MY_DIR + 'Tables.docx')
table = doc.first_section.body.tables[0]
# Enumerate through all cells of the table.
row = table.first_row
while row != None:
    cell = row.first_cell
    while cell != None:
        print(cell.get_text())
        cell = cell.next_cell
    row = row.next_row

See Also