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.
Merging can be done, if
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.
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 properties: