Show / Hide Table of Contents

Class WorksheetMergedCellsRegionCollection

A collection of WorksheetMergedCellsRegion instances in a Worksheet.

Inheritance
System.Object
WorksheetMergedCellsRegionCollection
Implements
System.Collections.Generic.ICollection<WorksheetMergedCellsRegion>
System.Collections.Generic.IEnumerable<WorksheetMergedCellsRegion>
System.Collections.IEnumerable
Namespace: Infragistics.Documents.Excel
Assembly: IgniteUI.Blazor.Documents.Excel.dll
Syntax
public sealed class WorksheetMergedCellsRegionCollection : Object, ICollection<WorksheetMergedCellsRegion>, IEnumerable<WorksheetMergedCellsRegion>, IEnumerable

Properties

Count

Gets the number of merged cell regions in the collection.

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32

The number of merged cell regions in the collection.

Item[Int32]

Gets the merged cell region at the specified index.

Declaration
public WorksheetMergedCellsRegion this[int index] { get; }
Parameters
Type Name Description
System.Int32 index

The zero-based index of the merged cell region to get.

Property Value
Type Description
WorksheetMergedCellsRegion

The merged cell region at the specified index.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

index is less than zero or index is greater than or equal to Count.

Methods

Add(Int32, Int32, Int32, Int32)

Creates new merged cell region and adds it to the collection.

Declaration
public WorksheetMergedCellsRegion Add(int firstRow, int firstColumn, int lastRow, int lastColumn)
Parameters
Type Name Description
System.Int32 firstRow

The index of the first row of the merged cell region.

System.Int32 firstColumn

The index of the first column of the merged cell region.

System.Int32 lastRow

The index of the last row of the merged cell region.

System.Int32 lastColumn

The index of the last row column of the merged cell region.

Returns
Type Description
WorksheetMergedCellsRegion

The newly created WorksheetMergedCellsRegion.

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.

Exceptions
Type Condition
System.InvalidOperationException

firstRow 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.

Clear()

Clears all merged cell regions from the collection.

Declaration
public void Clear()
Remarks

When a merged cell region is removed, the top-left cell in the region will retain the region's value. All other cells in the region will have a null value. In addition, all cells in the merged region will have the region's cell format when it is removed.

IsOverlappingWithMergedRegion(Int32, Int32, Int32, Int32)

Checks if any part of specified region is already a part of a merged cell region.

Declaration
public bool IsOverlappingWithMergedRegion(int firstRow, int firstColumn, int lastRow, int lastColumn)
Parameters
Type Name Description
System.Int32 firstRow

The index of the first row of the merged cell region.

System.Int32 firstColumn

The index of the first column of the merged cell region.

System.Int32 lastRow

The index of the last row of the merged cell region.

System.Int32 lastColumn

The index of the last row column of the merged cell region.

Returns
Type Description
System.Boolean

True if any part of specified region is a part of merged cell region; False otherwise.

Remove(WorksheetMergedCellsRegion)

Removes the specified merged cell region from the collection.

Declaration
public bool Remove(WorksheetMergedCellsRegion region)
Parameters
Type Name Description
WorksheetMergedCellsRegion region

The merged cell region to remove from the collection.

Returns
Type Description
System.Boolean

True if the merged cell region was successfully removed; False if the merged cell region was not in the collection.

Remarks

When a merged cell region is removed, the top-left cell in the region will retain the region's value. All other cells in the region will have a null value. In addition, all cells in the merged region will have the region's cell format when it is removed.

RemoveAt(Int32)

Removes the merged cell region at the specified index from the collection.

Declaration
public void RemoveAt(int index)
Parameters
Type Name Description
System.Int32 index

The zero-based index of the merged cell region in the collection.

Remarks

When a merged cell region is removed, the top-left cell in the region will retain the region's value. All other cells in the region will have a null value. In addition, all cells in the merged region will have the region's cell format when it is removed.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

index is less than zero or index is greater than or equal to Count.

Implements

System.Collections.Generic.ICollection<>
System.Collections.Generic.IEnumerable<>
System.Collections.IEnumerable

See Also

WorksheetMergedCellsRegion
MergedCellsRegions