Link Search Menu Expand Document

SSpread.GetCellSpan Method

</table>
Explanation Refers to the cell merge status.

You can check whether the specified cell is included in the merged cell. If included, you can get the column and row numbers for that anchor cell, and the number of columns and rows in the merged cell.

Use the AddCellSpan method to merge cells.
Use the RemoveCellSpan method to unmerge cells.
Call format GetCellSpan(col, row)
Return value Number object with the following child objects
Type Name Description
Number ColAnchor Anchor cell column number
Number RowAnchor Anchor cell row number
Number NumCols Number of columns in merged cell
Number NumRows Number of rows in merged cell

The Value property returns information about the specified cell with the following values:
Constant Value Description
$GetCellSpanNo 0 Not included in merged cells
$GetCellSpanYes 1 Included in the merged cell
$GetCellSpanAnchor 2 Corresponds to the anchor cell of the merged cell
Arguments col Column number of the referenced cell
row Row number of the referenced cell
Exception None
Example of use
   AddCellSpan(2, 3, 4, 4);
    var span = GetCellSpan(4, 4);
    if (span != $GetCellSpanNo) {
        print(span.ColAnchor, span.RowAnchor, span.NumCols, span.NumRows, "\n");
    }
    RemoveCellSpan(span.ColAnchor, span.RowAnchor);
    
Related item AddCellSpan, RemoveCellSpan methods