Represents a merged region of cells, or cells which share a value and format and appear as one cell when viewed in Microsoft Excel.

Merged cell regions cannot overlap (a cell can only belong to one merged cell region). In addition, [[ArrayFormula]] and [[WorksheetDataTable]] instances cannot be applied to merged cell regions.

Hierarchy

Hierarchy

Implements

  • ICellFormatOwner
  • IWorksheetCellFormatProxyOwner

Constructors

Properties

$type: Type
$t: Type
nextHashCode: number

Accessors

  • get cellFormat(): IWorksheetCellFormat
  • Gets the cell formatting for the merged cell region. The cell formatting for the merged cell region.

    Returns IWorksheetCellFormat

  • get comment(): WorksheetCellComment
  • Gets or sets the comment for the merged cells region.

    The comment of the merged region can also be accessed from the top-left cell of the merged region of cells.

    The comment for the merged cells region.

    Returns WorksheetCellComment

  • set comment(a): void
  • Parameters

    Returns void

  • get firstColumn(): number
  • Gets the index of the first column in the region. The index of the first column in the region.

    Returns number

  • get firstRow(): number
  • Gets the index of the first row in the region. The index of the first row in the region.

    Returns number

  • get formula(): Formula
  • Gets the formula which has been applied to the merged region. The formula which has been applied to the merged region or null if no formula has been applied.

    Returns Formula

  • get lastColumn(): number
  • Gets the index of the last column in the region. The index of the last column in the region.

    Returns number

  • get lastRow(): number
  • Gets the index of the last row in the region. The index of the last row in the region.

    Returns number

  • get value(): any
  • Gets or sets the value of the merged cell region.

    The types supported for the value are:

    • System.Byte
    • System.SByte
    • System.Int16
    • System.Int64
    • System.UInt16
    • System.UInt64
    • System.UInt32
    • System.Int32
    • System.Single
    • System.Double
    • System.Boolean
    • System.Char
    • System.Enum
    • System.Decimal
    • System.DateTime
    • System.String
    • System.Text.StringBuilder
    • System.DBNull
    • [[ErrorValue]]
    • [[FormattedString]]

    The value of the merged cell region.

    Throws

    [[NotSupportedException]] The assigned value's type is not supported and can't be exported to Excel.

    Throws

    [[InvalidOperationException]] The value assigned is a [[formula]]. Instead, [[Formula.applyTo]] should be called on the Formula, passing in the cell.

    Throws

    [[InvalidOperationException]] The value assigned is a [[WorksheetDataTable]]. Instead, the [[WorksheetDataTable.cellsInTable]] should be set to a region containing the cell.

    Throws

    [[InvalidOperationException]] The value assigned is a FormattedString which is the value another cell or merged cell region.

    Throws

    [[InvalidOperationException]] The value is assigned and this cell is part of an [[ArrayFormula]] or WorksheetDataTable.

    See

    • [[WorksheetCell.value]]
    • [[WorksheetCell.isCellTypeSupported]]

    Returns any

  • set value(a): void
  • Parameters

    • a: any

    Returns void

  • get worksheet(): Worksheet
  • Gets the worksheet on which the region resides. The worksheet on which the region resides or null if the region has been shifted off the worksheet.

    Returns Worksheet

Methods

  • Applies a array formula to the region of cells.

    'value' is parsed based on the [[CellReferenceMode]] of the [[Workbook]] to which the region belongs. If the region's [[worksheet]] has been removed from its parent collection, the A1 CellReferenceMode will be used to parse the formula.

    Throws

    [[ArgumentNullException]] 'value' is null or empty.

    Throws

    [[FormulaParseException]] 'value' is not a valid formula.

    Throws

    [[InvalidOperationException]] The region contains another array formula or data table which extends outside the region.

    See

    [[ArrayFormula]]

    Parameters

    • value: string

      The array formula to parse and apply to the region.

    Returns void

  • Applies a formula to the region of cells.

    'value' is parsed based on the [[CellReferenceMode]] of the [[Workbook]] to which the region belongs. If the region's [[worksheet]] has been removed from its parent collection, the A1 CellReferenceMode will be used to parse the formula.

    Throws

    [[ArgumentNullException]] 'value' is null or empty.

    Throws

    [[FormulaParseException]] 'value' is not a valid formula.

    Throws

    [[InvalidOperationException]] The region contains an array formula or data table which extends outside the region.

    See

    [[Formula]]

    Parameters

    • value: string

      The formula to parse and apply to the region.

    Returns void

  • Determines whether the specified value equals this [[WorksheetRegion]].

    Parameters

    • obj: any

      The value to test for equality.

    Returns boolean

  • Formats the region as a table and adds an associated [[WorksheetTable]] to the [[Worksheet.tables]] collection.

    When the table is created, the [[Workbook.defaultTableStyle]] will be applied to the value.

    When the table is created, the column names will be taken from the cells in the header row if 'tableHasHeaders' is True. If it is False, the column names will be generated and the cells for the header row will be inserted into the worksheet.

    The column names are unique within the owning WorksheetTable. If, when the table is created, there are two or more columns with the same name, the second and subsequent duplicate column names will have a number appended to make them unique. If any cells in the header row have a non-string value, their value will be changed to a string (the current display text of the cell). If any cells in the header row have no value, they will be given a generated column name.

    If the region partially contains any merged cell regions, they will be removed from the worksheet and the table region will be expanded to include all cells from the merged region.

    See

    • [[WorksheetTable.style]]
    • [[WorksheetTable]]
    • [[Worksheet.tables]]
    • [[WorksheetTableColumn.name]]
    • [[WorksheetTable.isHeaderRowVisible]]
    • [[WorksheetTableCollection.add]]

    Throws

    [[InvalidOperationException]] The region contains one or more cells from another [[WorksheetTable]].

    Throws

    [[InvalidOperationException]] The region contains one or more cells which have a multi-cell [[ArrayFormula]] applied.

    Throws

    [[InvalidOperationException]] The region contains one or more cells which are part of a [[WorksheetDataTable]].

    Parameters

    • tableHasHeaders: boolean

      A value which indicates whether the top row of the region contains the headers for the table.

    Returns WorksheetTable

  • Formats the region as a table and adds an associated [[WorksheetTable]] to the [[Worksheet.tables]] collection.

    When the table is created, the specified 'tableStyle' will be applied to the value.

    When the table is created, the column names will be taken from the cells in the header row if 'tableHasHeaders' is True. If it is False, the column names will be generated and the cells for the header row will be inserted into the worksheet.

    The column names are unique within the owning WorksheetTable. If, when the table is created, there are two or more columns with the same name, the second and subsequent duplicate column names will have a number appended to make them unique. If any cells in the header row have a non-string value, their value will be changed to a string (the current display text of the cell). If any cells in the header row have no value, they will be given a generated column name.

    If the region partially contains any merged cell regions, they will be removed from the worksheet and the table region will be expanded to include all cells from the merged region.

    See

    • [[WorksheetTable.style]]
    • [[WorksheetTable]]
    • [[Worksheet.tables]]
    • [[WorksheetTableColumn.name]]
    • [[Workbook.customTableStyles]]
    • [[Workbook.standardTableStyles]]
    • [[WorksheetTable.style]]
    • [[WorksheetTable.isHeaderRowVisible]]
    • [[WorksheetTableCollection.add]]

    Throws

    [[ArgumentException]] The specified 'tableStyle' does not exist in the [[Workbook.customTableStyles]] or [[Workbook.standardTableStyles]] collections.

    Throws

    [[InvalidOperationException]] The region contains one or more cells from another [[WorksheetTable]].

    Throws

    [[InvalidOperationException]] The region contains one or more cells which have a multi-cell [[ArrayFormula]] applied.

    Throws

    [[InvalidOperationException]] The region contains one or more cells which are part of a [[WorksheetDataTable]].

    Parameters

    • tableHasHeaders: boolean

      A value which indicates whether the top row of the region contains the headers for the table.

    • tableStyle: WorksheetTableStyle

      The [[WorksheetTableStyle]] to apply to the table or null to use the [[Workbook.defaultTableStyle]].

    Returns WorksheetTable

  • Gets the bounds of the region in twips (1/20th of a point).

    The bounds returned by this method are only valid with the current configuration of the worksheet. If any rows or columns before the region are resized, these bounds will no longer reflect the position of the region.

    Returns IgRect

  • Gets the bounds of the region in twips (1/20th of a point).

    The bounds returned by this method are only valid with the current configuration of the worksheet. If any rows or columns before the region are resized, these bounds will no longer reflect the position of the region.

    Parameters

    Returns IgRect

  • Gtes the hash code for the [[WorksheetRegion]].

    Returns number

  • Gets the resolved cell formatting for this merged cell region.

    If any cell format properties are the default values on the merged cell region, the values from the owning row's cell format will be used. If those are default, then the values from the owning column's cell format will be used. Otherwise, the workbook default values will be used.

    See

    • [[cellFormat]]
    • [[RowColumnBase.cellFormat]]

    Returns IWorksheetCellFormat

  • Gets the string representation of the range of cells in the region.

    Returns string

  • Gets the string representation of the range of cells in the region.

    Parameters

    • cellReferenceMode: CellReferenceMode

      The mode used to generate cell references.

    • includeWorksheetName: boolean

      The value indicating whether to include the worksheet name in the range address.

    Returns string

  • Gets the string representation of the range of cells in the region.

    Parameters

    • cellReferenceMode: CellReferenceMode

      The mode used to generate cell references.

    • includeWorksheetName: boolean

      The value indicating whether to include the worksheet name in the range address.

    • useRelativeColumn: boolean

      The value indicating whether to use a relative column address for the cells in the range.

    • useRelativeRow: boolean

      The value indicating whether to use a relative row address for the cells in the range.

    Returns string

  • Parameters

    • item1: any
    • item2: any

    Returns number

  • Parameters

    • item1: any
    • item2: any

    Returns number

  • Parameters

    • item1: any
    • item2: any

    Returns boolean

  • Parameters

    • a: any
    • b: any

    Returns boolean

  • Parameters

    • obj: any

    Returns any[]

  • Parameters

    • obj: any

    Returns number

  • Parameters

    • a: any
    • b: any

    Returns boolean