TRVTableItemInfo.CanMergeCells

<< Click to display table of contents >>

TRVTableItemInfo.CanMergeCells

Returns: is cell-merging of the specified cells possible?

function CanMergeCells(TopRow, LeftCol, ColSpan, RowSpan: Integer;

  AllowMergeRC: Boolean): Boolean;

Potential area for cell-merging is specified in TopRow, TopCol, ColSpan, RowSpan.

TopRow, TopCol position of the top left cell for cell-merging.

ColSpan number of columns for merging.

RowSpan number of rows for merging.

If merging will be performed, the resulting cell will be Cells[TopRow, TopCol] with ColSpan=ColSpan and RowSpan=RowSpan.

 

Merging can be done, if

1.Cells[TopRow, TopCol]<>nil.

2.This area defines a rectangular piece of table (there are no cells overlapping its border due to previous cell-merging). This requirement covers the 1st one.

3.Either Cells[TopRow, TopCol].ColSpan < ColSpan or Cells[TopRow, TopCol].RowSpan < RowSpan.

4.If AllowMergeRC=True, this function returns False, if one or more rows or columns will contain only nils after merging. It's not recommended to have such rows/columns, so you can either forbid such operation or (better) delete them with DeleteEmptyRows and DeleteEmptyCols.

 

See also:

CanMergeSelectedCells;

MergeCells;

MergeSelectedCells.

See also properties:

ColCount;

RowCount.