AbsoluteCellRange
Class
Represents a rectangular range of cells anchored at absolute coordinates within a single sheet.
Constructors
Section titled “Constructors”constructor
Section titled “constructor”+ new AbsoluteCellRange(start: SimpleCellAddress, end: SimpleCellAddress): AbsoluteCellRange
Defined in hyperformula/src/AbsoluteCellRange.ts:56
Creates a new absolute cell range.
Parameters:
| Name | Type | Description |
|---|---|---|
start |
SimpleCellAddress | Top-left cell address (must share the sheet with end) |
end |
SimpleCellAddress | Bottom-right cell address (must share the sheet with start) |
Returns: AbsoluteCellRange
Properties
Section titled “Properties”Readonly
• end: SimpleCellAddress
Defined in hyperformula/src/AbsoluteCellRange.ts:56
Readonly
• start: SimpleCellAddress
Defined in hyperformula/src/AbsoluteCellRange.ts:55
Accessors
Section titled “Accessors”• get sheet(): number
Defined in hyperformula/src/AbsoluteCellRange.ts:78
The sheet index this range belongs to.
Returns: number
Sheet index
Methods
Section titled “Methods”addressInRange
Section titled “addressInRange”▸ addressInRange(address: SimpleCellAddress): boolean
Defined in hyperformula/src/AbsoluteCellRange.ts:236
Checks whether the given address lies within this range.
Parameters:
| Name | Type | Description |
|---|---|---|
address |
SimpleCellAddress | Address to test |
Returns: boolean
True if the address is inside the range
addresses
Section titled “addresses”▸ addresses(dependencyGraph: DependencyGraph): SimpleCellAddress[]
Defined in hyperformula/src/AbsoluteCellRange.ts:517
Returns every address in the range (clipped to the sheet’s effective bounds) as a flat row-major list.
Parameters:
| Name | Type | Description |
|---|---|---|
dependencyGraph |
DependencyGraph | Graph used to resolve effective sheet bounds |
Returns: SimpleCellAddress[]
Flat list of cell addresses
addressesArrayMap
Section titled “addressesArrayMap”▸ addressesArrayMap‹T›(dependencyGraph: DependencyGraph, op: function): T[][]
Defined in hyperformula/src/AbsoluteCellRange.ts:496
Maps each address in the range (clipped to the sheet’s effective bounds) through a callback and returns the results in row-major 2D form.
Type parameters:
▪ T
Parameters:
▪ dependencyGraph: DependencyGraph
Graph used to resolve effective sheet bounds
▪ op: function
Callback invoked for each address
▸ (arg: SimpleCellAddress): T
Parameters:
| Name | Type |
|---|---|
arg |
SimpleCellAddress |
Returns: T[][]
Mapped values indexed by [row][column]
addressesWithDirection
Section titled “addressesWithDirection”▸ addressesWithDirection(right: number, bottom: number, dependencyGraph: DependencyGraph): IterableIterator‹SimpleCellAddress›
Defined in hyperformula/src/AbsoluteCellRange.ts:540
Iterates over every address in the range in a chosen direction (clipped to the sheet’s effective bounds).
yields {SimpleCellAddress} The next cell address in the chosen iteration order
Parameters:
| Name | Type | Description |
|---|---|---|
right |
number | Positive iterates columns right-to-left, non-positive iterates left-to-right |
bottom |
number | Positive iterates rows bottom-to-top, non-positive iterates top-to-bottom |
dependencyGraph |
DependencyGraph | Graph used to resolve effective sheet bounds |
Returns: IterableIterator‹SimpleCellAddress›
arrayOfAddressesInRange
Section titled “arrayOfAddressesInRange”▸ arrayOfAddressesInRange(): SimpleCellAddress[][]
Defined in hyperformula/src/AbsoluteCellRange.ts:450
Builds a 2D array of every cell address in the range, indexed by [row][column].
Returns: SimpleCellAddress[][]
Rectangular grid of cell addresses
columnInRange
Section titled “columnInRange”▸ columnInRange(address: SimpleColumnAddress): boolean
Defined in hyperformula/src/AbsoluteCellRange.ts:252
Checks whether the given column lies within this range.
Parameters:
| Name | Type | Description |
|---|---|---|
address |
SimpleColumnAddress | Column address to test |
Returns: boolean
True if the column is inside the range
containsRange
Section titled “containsRange”▸ containsRange(range: AbsoluteCellRange): boolean
Defined in hyperformula/src/AbsoluteCellRange.ts:276
Checks whether this range fully contains another range.
Parameters:
| Name | Type | Description |
|---|---|---|
range |
AbsoluteCellRange | Range to test for containment |
Returns: boolean
True if the other range is fully inside this range
doesOverlap
Section titled “doesOverlap”▸ doesOverlap(other: AbsoluteCellRange): boolean
Defined in hyperformula/src/AbsoluteCellRange.ts:218
Checks whether this range overlaps another range (must be on the same sheet to overlap).
Parameters:
| Name | Type | Description |
|---|---|---|
other |
AbsoluteCellRange | Range to compare against |
Returns: boolean
True if the ranges share at least one cell
effectiveEndColumn
Section titled “effectiveEndColumn”▸ effectiveEndColumn(_dependencyGraph: DependencyGraph): number
Defined in hyperformula/src/AbsoluteCellRange.ts:616
Returns the effective last column index, accounting for unbounded ranges resolved through the dependency graph.
Parameters:
| Name | Type | Description |
|---|---|---|
_dependencyGraph |
DependencyGraph | Dependency graph (unused on the bounded base implementation) |
Returns: number
Effective last column index
effectiveEndRow
Section titled “effectiveEndRow”▸ effectiveEndRow(_dependencyGraph: DependencyGraph): number
Defined in hyperformula/src/AbsoluteCellRange.ts:625
Returns the effective last row index, accounting for unbounded ranges resolved through the dependency graph.
Parameters:
| Name | Type | Description |
|---|---|---|
_dependencyGraph |
DependencyGraph | Dependency graph (unused on the bounded base implementation) |
Returns: number
Effective last row index
effectiveHeight
Section titled “effectiveHeight”▸ effectiveHeight(_dependencyGraph: DependencyGraph): number
Defined in hyperformula/src/AbsoluteCellRange.ts:643
Returns the effective height of the range, accounting for unbounded ranges resolved through the dependency graph.
Parameters:
| Name | Type | Description |
|---|---|---|
_dependencyGraph |
DependencyGraph | Dependency graph (unused on the bounded base implementation) |
Returns: number
Effective height in rows
effectiveWidth
Section titled “effectiveWidth”▸ effectiveWidth(_dependencyGraph: DependencyGraph): number
Defined in hyperformula/src/AbsoluteCellRange.ts:634
Returns the effective width of the range, accounting for unbounded ranges resolved through the dependency graph.
Parameters:
| Name | Type | Description |
|---|---|---|
_dependencyGraph |
DependencyGraph | Dependency graph (unused on the bounded base implementation) |
Returns: number
Effective width in columns
exceedsSheetSizeLimits
Section titled “exceedsSheetSizeLimits”▸ exceedsSheetSizeLimits(maxColumns: number, maxRows: number): boolean
Defined in hyperformula/src/AbsoluteCellRange.ts:607
Checks whether the range exceeds the configured sheet size limits.
Parameters:
| Name | Type | Description |
|---|---|---|
maxColumns |
number | Maximum number of columns allowed by the sheet |
maxRows |
number | Maximum number of rows allowed by the sheet |
Returns: boolean
True if the range escapes the limits
expandByColumns
Section titled “expandByColumns”▸ expandByColumns(numberOfColumns: number): void
Defined in hyperformula/src/AbsoluteCellRange.ts:361
Extends the right edge of the range by a number of columns (mutates this range).
Parameters:
| Name | Type | Description |
|---|---|---|
numberOfColumns |
number | Number of columns to add at the right |
Returns: void
expandByRows
Section titled “expandByRows”▸ expandByRows(numberOfRows: number): void
Defined in hyperformula/src/AbsoluteCellRange.ts:334
Extends the bottom edge of the range by a number of rows (mutates this range).
Parameters:
| Name | Type | Description |
|---|---|---|
numberOfRows |
number | Number of rows to add at the bottom |
Returns: void
getAddress
Section titled “getAddress”▸ getAddress(col: number, row: number): SimpleCellAddress
Defined in hyperformula/src/AbsoluteCellRange.ts:594
Returns the address of the cell at the given offset inside the range.
Parameters:
| Name | Type | Description |
|---|---|---|
col |
number | Zero-based column offset from the left edge |
row |
number | Zero-based row offset from the top edge |
Returns: SimpleCellAddress
Absolute address of the offset cell
height
Section titled “height”▸ height(): number
Defined in hyperformula/src/AbsoluteCellRange.ts:434
Returns the height (number of rows) of the range.
Returns: number
Height in rows
includesColumn
Section titled “includesColumn”▸ includesColumn(column: number): boolean
Defined in hyperformula/src/AbsoluteCellRange.ts:317
Checks whether the given column index is strictly right of the left edge and at or before the right edge.
Parameters:
| Name | Type | Description |
|---|---|---|
column |
number | Column index to test |
Returns: boolean
True if the column lies inside the range (excluding the left boundary)
includesRow
Section titled “includesRow”▸ includesRow(row: number): boolean
Defined in hyperformula/src/AbsoluteCellRange.ts:308
Checks whether the given row index is strictly below the top edge and at or above the bottom edge.
Parameters:
| Name | Type | Description |
|---|---|---|
row |
number | Row index to test |
Returns: boolean
True if the row lies inside the range (excluding the top boundary)
intersectionWith
Section titled “intersectionWith”▸ intersectionWith(other: AbsoluteCellRange): Maybe‹AbsoluteCellRange›
Defined in hyperformula/src/AbsoluteCellRange.ts:285
Computes the intersection of this range with another range on the same sheet.
Parameters:
| Name | Type | Description |
|---|---|---|
other |
AbsoluteCellRange | Range to intersect with |
Returns: Maybe‹AbsoluteCellRange›
Intersection range, or undefined when the ranges do not overlap
isFinite
Section titled “isFinite”▸ isFinite(): boolean
Defined in hyperformula/src/AbsoluteCellRange.ts:209
Indicates whether the range has finite size (no infinite row/column extent).
Returns: boolean
True if the range is finite
moveToSheet
Section titled “moveToSheet”▸ moveToSheet(toSheet: number): void
Defined in hyperformula/src/AbsoluteCellRange.ts:369
Moves the range to a different sheet (mutates this range).
Parameters:
| Name | Type | Description |
|---|---|---|
toSheet |
number | Target sheet index |
Returns: void
rangeWithSameHeight
Section titled “rangeWithSameHeight”▸ rangeWithSameHeight(startColumn: number, numberOfColumns: number): AbsoluteCellRange
Defined in hyperformula/src/AbsoluteCellRange.ts:410
Builds a new range with the same row extent as this one but rooted at a different column.
Parameters:
| Name | Type | Description |
|---|---|---|
startColumn |
number | Left column of the new range |
numberOfColumns |
number | Width of the new range |
Returns: AbsoluteCellRange
New range with this range’s height
rangeWithSameWidth
Section titled “rangeWithSameWidth”▸ rangeWithSameWidth(startRow: number, numberOfRows: number): AbsoluteCellRange
Defined in hyperformula/src/AbsoluteCellRange.ts:400
Builds a new range with the same column extent as this one but rooted at a different row.
Parameters:
| Name | Type | Description |
|---|---|---|
startRow |
number | Top row of the new range |
numberOfRows |
number | Height of the new range |
Returns: AbsoluteCellRange
New range with this range’s width
removeSpan
Section titled “removeSpan”▸ removeSpan(span: Span): void
Defined in hyperformula/src/AbsoluteCellRange.ts:378
Removes a span of rows or columns from the range (mutates this range).
Parameters:
| Name | Type | Description |
|---|---|---|
span |
Span | Span describing the rows or columns to remove |
Returns: void
rowInRange
Section titled “rowInRange”▸ rowInRange(address: SimpleRowAddress): boolean
Defined in hyperformula/src/AbsoluteCellRange.ts:264
Checks whether the given row lies within this range.
Parameters:
| Name | Type | Description |
|---|---|---|
address |
SimpleRowAddress | Row address to test |
Returns: boolean
True if the row is inside the range
sameAs
Section titled “sameAs”▸ sameAs(other: AbsoluteCellRange): boolean
Defined in hyperformula/src/AbsoluteCellRange.ts:485
Checks whether this range has the same start and end addresses as another range.
Parameters:
| Name | Type | Description |
|---|---|---|
other |
AbsoluteCellRange | Range to compare against |
Returns: boolean
True if both endpoints match
sameDimensionsAs
Section titled “sameDimensionsAs”▸ sameDimensionsAs(other: AbsoluteCellRange): boolean
Defined in hyperformula/src/AbsoluteCellRange.ts:476
Checks whether this range has the same width and height as another range.
Parameters:
| Name | Type | Description |
|---|---|---|
other |
AbsoluteCellRange | Range to compare against |
Returns: boolean
True if both width and height match
shiftByColumns
Section titled “shiftByColumns”▸ shiftByColumns(numberOfColumns: number): void
Defined in hyperformula/src/AbsoluteCellRange.ts:342
Shifts the entire range horizontally by a number of columns (mutates this range).
Parameters:
| Name | Type | Description |
|---|---|---|
numberOfColumns |
number | Number of columns to shift by (negative shifts leftward) |
Returns: void
shiftByRows
Section titled “shiftByRows”▸ shiftByRows(numberOfRows: number): void
Defined in hyperformula/src/AbsoluteCellRange.ts:325
Shifts the entire range vertically by a number of rows (mutates this range).
Parameters:
| Name | Type | Description |
|---|---|---|
numberOfRows |
number | Number of rows to shift by (negative shifts upward) |
Returns: void
shifted
Section titled “shifted”▸ shifted(byCols: number, byRows: number): AbsoluteCellRange
Defined in hyperformula/src/AbsoluteCellRange.ts:353
Returns a new range shifted by the given offsets without mutating this range.
Parameters:
| Name | Type | Description |
|---|---|---|
byCols |
number | Column offset |
byRows |
number | Row offset |
Returns: AbsoluteCellRange
New shifted range
shouldBeRemoved
Section titled “shouldBeRemoved”▸ shouldBeRemoved(): boolean
Defined in hyperformula/src/AbsoluteCellRange.ts:390
Reports whether the range has collapsed and should be discarded.
Returns: boolean
True if width or height is non-positive
▸ size(): number
Defined in hyperformula/src/AbsoluteCellRange.ts:442
Returns the number of cells in the range.
Returns: number
Width multiplied by height
toString
Section titled “toString”▸ toString(): string
Defined in hyperformula/src/AbsoluteCellRange.ts:418
Builds a debug string representation of the range.
Returns: string
Comma-separated sheet,startCol,startRow,endCol,endRow
▸ width(): number
Defined in hyperformula/src/AbsoluteCellRange.ts:426
Returns the width (number of columns) of the range.
Returns: number
Width in columns
withStart
Section titled “withStart”▸ withStart(newStart: SimpleCellAddress): AbsoluteCellRange
Defined in hyperformula/src/AbsoluteCellRange.ts:467
Returns a new range with the start address replaced (end address is reused).
Parameters:
| Name | Type | Description |
|---|---|---|
newStart |
SimpleCellAddress | New top-left cell of the range |
Returns: AbsoluteCellRange
New range
fromAst
Section titled “fromAst”Static
▸ fromAst(ast: CellRangeAst | ColumnRangeAst | RowRangeAst, baseAddress: SimpleCellAddress): AbsoluteCellRange
Defined in hyperformula/src/AbsoluteCellRange.ts:113
Builds an absolute range from a range AST node resolved against a base address.
Parameters:
| Name | Type | Description |
|---|---|---|
ast |
CellRangeAst | ColumnRangeAst | RowRangeAst | Range AST node |
baseAddress |
SimpleCellAddress | Address used to resolve relative references |
Returns: AbsoluteCellRange
Resolved absolute range
fromAstOrUndef
Section titled “fromAstOrUndef”Static
▸ fromAstOrUndef(ast: CellRangeAst | ColumnRangeAst | RowRangeAst, baseAddress: SimpleCellAddress): Maybe‹AbsoluteCellRange›
Defined in hyperformula/src/AbsoluteCellRange.ts:129
Same as AbsoluteCellRange.fromAst but returns undefined when the AST cannot be resolved into a valid range.
Parameters:
| Name | Type | Description |
|---|---|---|
ast |
CellRangeAst | ColumnRangeAst | RowRangeAst | Range AST node |
baseAddress |
SimpleCellAddress | Address used to resolve relative references |
Returns: Maybe‹AbsoluteCellRange›
Resolved range, or undefined on failure
fromCellRange
Section titled “fromCellRange”Static
▸ fromCellRange(x: CellRange, baseAddress: SimpleCellAddress): AbsoluteCellRange
Defined in hyperformula/src/AbsoluteCellRange.ts:143
Builds an absolute range from a CellRange (with relative or absolute components) resolved against a base address.
Parameters:
| Name | Type | Description |
|---|---|---|
x |
CellRange | Range with possibly relative components |
baseAddress |
SimpleCellAddress | Address used to resolve relative references |
Returns: AbsoluteCellRange
Resolved absolute range
fromCoordinates
Section titled “fromCoordinates”Static
▸ fromCoordinates(sheet: number, x1: number, y1: number, x2: number, y2: number): AbsoluteCellRange
Defined in hyperformula/src/AbsoluteCellRange.ts:201
Builds an absolute range from raw integer coordinates.
Parameters:
| Name | Type | Description |
|---|---|---|
sheet |
number | Sheet index |
x1 |
number | Start column |
y1 |
number | Start row |
x2 |
number | End column |
y2 |
number | End row |
Returns: AbsoluteCellRange
New absolute range
fromSimpleCellAddresses
Section titled “fromSimpleCellAddresses”Static
▸ fromSimpleCellAddresses(start: SimpleCellAddress, end: SimpleCellAddress): AbsoluteCellRange
Defined in hyperformula/src/AbsoluteCellRange.ts:88
Builds an absolute range from two cell addresses, selecting the most specific subtype based on finiteness of width/height.
Parameters:
| Name | Type | Description |
|---|---|---|
start |
SimpleCellAddress | Top-left cell address |
end |
SimpleCellAddress | Bottom-right cell address |
Returns: AbsoluteCellRange
Cell, column, or row range depending on dimensions
spanFrom
Section titled “spanFrom”Static
▸ spanFrom(topLeftCorner: SimpleCellAddress, width: number, height: number): AbsoluteCellRange
Defined in hyperformula/src/AbsoluteCellRange.ts:157
Builds an absolute range with the given dimensions starting at the top-left corner.
Parameters:
| Name | Type | Description |
|---|---|---|
topLeftCorner |
SimpleCellAddress | Top-left cell of the range |
width |
number | Number of columns (may be infinite) |
height |
number | Number of rows (may be infinite) |
Returns: AbsoluteCellRange
New absolute range
spanFromOrUndef
Section titled “spanFromOrUndef”Static
▸ spanFromOrUndef(topLeftCorner: SimpleCellAddress, width: number, height: number): Maybe‹AbsoluteCellRange›
Defined in hyperformula/src/AbsoluteCellRange.ts:172
Same as AbsoluteCellRange.spanFrom but returns undefined for impossible spans (e.g. infinite-column range not anchored at row 0).
Parameters:
| Name | Type | Description |
|---|---|---|
topLeftCorner |
SimpleCellAddress | Top-left cell of the range |
width |
number | Number of columns (may be infinite) |
height |
number | Number of rows (may be infinite) |
Returns: Maybe‹AbsoluteCellRange›
New absolute range, or undefined on invalid input