Search Results for

    Show / Hide Table of Contents

    ExcelFile.MergeCells Method

    Merges a number of cells into one.

    Remarks

    This method might return a bigger range than the one you specify. For example, if you have a merged cell (A1:C1), calling MergeCells(1,2,2,2) will merge the cell with the existing one, returning ONE merged cell (A1:C2), and not (B1:B2)

    Other thing to consider, is that Excel honors individual linestyles inside a merged cell. That is, you can have only the first 2 columns of the merged cell with a line and the others without. Normally, after merging the cells, you will want to call SetCellFormat(Int32, Int32, Int32) on the range to make them all similar. FlexCel does not do it by default, to give the choice to you.

    Syntax

    Namespace: FlexCel.Core

    public abstract void MergeCells(Int32 firstRow, Int32 firstCol, Int32 lastRow, Int32 lastCol)

    Parameters

    <-> Parameter Type Description
    firstRow Int32 First row of the merged cell.
    firstCol Int32 First column of the merged cell.
    lastRow Int32 Last row of the merged cell.
    lastCol Int32 Last column of the merged cell.

    See also

    • ExcelFile
    • CellMergedBounds
    • UnMergeCells
    • CellMergedListCount
    • CellMergedList
    In This Article
    Back to top FlexCel Studio for the .NET Framework v7.24.0.0
    © 2002 - 2025 tmssoftware.com