Skip to content

Range

A Range specifies an area in cell coordinate space that is enclosed by the Range’s upper-left point (top,left) and its lower-right point (bottom,right), both inclusive.

new Range(src): Range

zero-based coordinates of the bounds of a range, and optionally the “lockedness” of any of those bounds. The bottom and right bounds default to top and left, respectively.

boolean

boolean

boolean

boolean

number

number

number

number

number

Range

$bottom: boolean


$left: boolean


$right: boolean


$top: boolean


bottom: number


left: number


right: number


top: number


unbounded: Unbounded


static MAX_COL: number


static MAX_ROW: number

get height(): number

number


get isCollapsed(): boolean

Returns true if this is 1x1, a single-cell range.

boolean


get size(): number

number


get width(): number

number

collapse(toTopLeft?): Range

Returns a new Range collapsed to a single point at to one of the boundary points of this range.

boolean = true

true collapses the Range to its top/left corner, false to its bottom/right.

Range


collapseToBottomRight(): Range

Returns a new Range collapsed to a single point at the bottom-right corner of this range. Does not copy lock attributes ($top etc.).

Range


collapseToColumn(c?): Range

Returns a new Range collapsed to the given column of this range (default leftmost column). Does not copy lock attributes ($top etc.). Does not check bounds, so result will be outside this range if c >= width.

number = 0

zero-based index of the column to collapse to.

Range


collapseToRow(r?): Range

Returns a new Range collapsed to the given row of this range (default top row) Does not copy lock attributes ($top etc.). Does not check bounds, so result will be outside this range if r >= height.

number = 0

zero-based index of the row to collapse to.

Range


collapseToTopLeft(): Range

Returns a new Range collapsed to a single point at the top-left corner of this range. Does not copy lock attributes ($top etc.).

Range


contains(rangeOrCoords): boolean

Checks whether the specified range is fully covered by this range.

SlimRangeOrCoords

the reference range with which to compare.

boolean


equals(range): boolean

Compares this range to another range to test if their defined rectangles are equal. This only tests the values of top, left, bottom, right; ignoring any locks.

the reference range with which to compare.

null | SlimRange

boolean


except(range): IterableIterator<Range>

Subtract the supplied range from the current one. Yields up to 4 ranges, depending on how the ranges overlap.

SlimRange

IterableIterator<Range>


extendSide(side, position): Range

Side

number

Range


extendToLength(newLength): Range

Returns a new Range with the same shorter dimension as this one, but the longer dimension set to newLength. (This will make the longer dimension the shorter one, if newLength < the shorter dimension. The intended use case of this is to extend rather than contract, in which case the longer dimension remains longer, so this will need changing if the opposite use case becomes relevant.) Does not copy lock attributes ($top etc.).

number

the length of the longer dimension (width or height) of the new range

Range

a range like this one but with its longer dimension changed to newLength.


getIntersection(other): null | Range

SlimRange

null | Range


intersects(range): boolean

SlimRange

boolean


iterCoordinates(): IterableIterator<{ column: number; row: number; }>

IterableIterator<{ column: number; row: number; }>


moveBy(deltaX, deltaY): Range

number

number

Range

a new range that has been shifted by X and Y.


strictEquals(range): boolean

Compares this range to another range to test if their defined rectangles are equal. This tests both the rectangles as well as the status of locks on the dimensions.

the reference range with which to compare.

null | SlimRange & Pick<Range, "$top" | "$bottom" | "$left" | "$right">

boolean


toBoundingBox(): object

object

maxX: number = right

maxY: number = bottom

minX: number = left

minY: number = top


toString(abs): string

boolean = false

string


static createColumnRange(left, right?): Range

number

number = left

defaults to left

Range


static createRowRange(top, bottom?): Range

number

number = top

defaults to top

Range


static withinBounds(col, row): boolean

number

number

boolean