Merges the specified cells in one.
procedure MergeCells(TopRow, LeftCol, ColSpan, RowSpan: Integer; AllowMergeRC: Boolean);
TopRow, LeftCol – position of the top left cell for cell-merging.
ColSpan – number of columns for merging.
RowSpan – number of rows for merging.
This method fails (does nothing) if the parameters do not define a rectangle (because of previous cell merging). You can check the possibility of merging using CanMergeCells.
AllowMergeRC = False forbids to perform merging, if it will cause appearing rows or columns containing only nils. It's not recommended to have such rows/columns, so you can either forbid such operation or to delete them using DeleteEmptyRows and DeleteEmptyCols (the latter is recommended).
See also methods: