Back to Devexpress

Table.GetActiveCells(TableTraversalOrder) Method

officefileapi-devexpress-dot-docs-dot-presentation-dot-table-dot-getactivecells-x28-devexpress-dot-docs-dot-presentation-dot-tabletraversalorder-x29.md

latest2.9 KB
Original Source

Table.GetActiveCells(TableTraversalOrder) Method

Returns all active cells in the table, skipping merged cells that do not display data.

Namespace : DevExpress.Docs.Presentation

Assembly : DevExpress.Docs.Presentation.v25.2.dll

NuGet Package : DevExpress.Docs.Presentation

Declaration

csharp
public IEnumerable<TableCell> GetActiveCells(
    TableTraversalOrder order
)
vb
Public Function GetActiveCells(
    order As TableTraversalOrder
) As IEnumerable(Of TableCell)

Parameters

NameTypeDescription
orderTableTraversalOrder

The order in which to traverse the table cells.

|

Returns

TypeDescription
IEnumerable<TableCell>

A collection of table cells.

|

Remarks

If you merge two cells, both of those cells remain in the internal table structure. One becomes the resulting cell (takes the space of two and displays data). Another disappears from the table (the object remains in case you split the merged cell back into two).

To obtain all cells that display data, call Table.GetActiveCells. This method skips cells that only exist in the internal structure and do not display data. If you traverse cells manually, you can identify these inactive cells by checking if IsMergedVertically or IsMergedHorizontally is true.

The following code snippet iterates through all active cells in a table and obtains a list of 8 cells:

csharp
using DevExpress.Docs.Presentation;

    IEnumerable<TableCell> tableCells = table.GetActiveCells(TableTraversalOrder.RowThenColumn);
vb
Imports DevExpress.Docs.Presentation

    Dim tableCells As IEnumerable(Of TableCell) = table.GetActiveCells(TableTraversalOrder.RowThenColumn)

See Also

Table Class

Table Members

DevExpress.Docs.Presentation Namespace