Version

Add Method (WorksheetMergedCellsRegionCollection)

Creates new merged cell region and adds it to the collection.
Syntax
'Declaration
 
Public Function Add( _
   ByVal firstRow As Integer, _
   ByVal firstColumn As Integer, _
   ByVal lastRow As Integer, _
   ByVal lastColumn As Integer _
) As WorksheetMergedCellsRegion
public WorksheetMergedCellsRegion Add( 
   int firstRow,
   int firstColumn,
   int lastRow,
   int lastColumn
)

Parameters

firstRow
The index of the first row of the merged cell region.
firstColumn
The index of the first column of the merged cell region.
lastRow
The index of the last row of the merged cell region.
lastColumn
The index of the last row column of the merged cell region.

Return Value

The newly created WorksheetMergedCellsRegion.
Exceptions
ExceptionDescription
System.InvalidOperationExceptionfirstRow is greater than lastRow or firstColumn is greater than lastColumn.
System.ArgumentOutOfRangeException Any row or column indices specified are outside the valid row or column ranges.
System.InvalidOperationException The new merged cell region overlaps with an existing merged cell region.
Remarks

The new merged cell region will take its value from the first cell containing a value, starting at the top-left and going across then down in the region. The value of all other cells will be lost. Similarly, the new region will initialize its cell format from the first cell containing a non-default cell format.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also