Members
-
fromCellCoords
-
Usually the same as highlight, but in Excel there is distinction - one can change
highlight within a selection. -
highlightCellCoords
-
Used to draw bold border around a cell where selection was started and to edit the cell
when you press Enter. The highlight cannot point to headers (negative values) so its
coordinates object is normalized while assigning. -
End selection.
Methods
-
clone(){CellRange}
-
Clones the range coordinates.
Returns: {CellRange}
-
expand(cellCoords){boolean}
-
Adds a cell to a range (only if exceeds corners of the range). Returns information if range was expanded.
Parameters:
Name Type Description cellCoords
CellCoords The cell coordinates.
Returns: {boolean}
-
expandByRange(expandingRange){boolean}
-
Expand the current object by the range passed in the first argument.
Parameters:
Name Type Description expandingRange
CellRange Object extending the range.
Returns: {boolean}
-
flipDirectionHorizontally()
-
Flip the direction horizontally. (e.g.
NW-SE
changes toNE-SW
). -
flipDirectionVertically()
-
Flip the direction vertically. (e.g.
NW-SE
changes toSW-NE
). -
forAll(callback)
-
Runs a callback function against all cells in the range. You can break the iteration by returning
false
in the callback function.Parameters:
Name Type Description callback
function The callback function.
-
getAll(){Array}
-
Get all selected cell coords defined by this range.
Returns: {Array}
-
getBordersSharedWith(range){Array}
-
Parameters:
Name Type Description range
CellRange The cells range to compare with.
Returns: {Array}
-
getBottomLeftCorner(){CellCoords}
-
Gets the bottom left corner of this range. If the corner contains header coordinates
(negative values), the corner coordinates will be normalized to 0.Returns: {CellCoords}
-
getBottomRightCorner(){CellCoords}
-
Gets the bottom right corner of this range. If the corner contains header coordinates
(negative values), the corner coordinates will be normalized to 0.Returns: {CellCoords}
-
getDirection(){string}
-
Gets the direction of the selection.
Returns: {string} Returns one of the values:
'NW-SE'
,'NE-SW'
,'SE-NW'
,'SW-NE'
. -
getHeight(){number}
-
Returns selected range height (in number of rows excluding rows' headers).
Returns: {number}
-
getHorizontalDirection(){string}
-
Gets the horizontal direction of the range.
Returns: {string} Returns one of the values:
W-E
(west->east),E-W
(east->west). -
getInner(){Array}
-
Get inner selected cell coords defined by this range.
Returns: {Array}
-
getOppositeCorner(coords, expandedRange){CellCoords}
-
Gets coordinates of the corner which is opposite to the matched. When the passed coordinates matched to the
bottom-right corner of this range then the coordinates for top-left will be returned.Parameters:
Name Type Description coords
CellCoords Cell coordinates to check.
expandedRange
CellRange optional The cells range to compare with.
Returns: {CellCoords}
-
getOuterBottomLeftCorner(){CellCoords}
-
Gets the bottom left corner of this range. If the corner contains header coordinates
(negative values), then the left coordinate will be pointed to that header.Returns: {CellCoords}
-
getOuterBottomRightCorner(){CellCoords}
-
Gets the bottom right corner of this range.
Returns: {CellCoords}
-
getOuterHeight(){number}
-
Returns selected range height (in number of rows including rows' headers).
Returns: {number}
-
getOuterTopLeftCorner(){CellCoords}
-
Gets the top left corner of this range. If the corner contains header coordinates
(negative values), then the top and left coordinates will be pointed to that header.Returns: {CellCoords}
-
getOuterTopRightCorner(){CellCoords}
-
Gets the top right corner of this range. If the corner contains header coordinates
(negative values), then the top coordinate will be pointed to that header.Returns: {CellCoords}
-
getOuterWidth(){number}
-
Returns selected range width (in number of columns including columns' headers).
Returns: {number}
-
getTopLeftCorner(){CellCoords}
-
Gets the top left corner of this range. If the corner contains header coordinates
(negative values), the corner coordinates will be normalized to 0.Returns: {CellCoords}
-
getTopRightCorner(){CellCoords}
-
Gets the top right corner of this range. If the corner contains header coordinates
(negative values), the corner coordinates will be normalized to 0.Returns: {CellCoords}
-
getVerticalDirection(){string}
-
Gets the vertical direction of the range.
Returns: {string} Returns one of the values:
N-S
(north->south),S-N
(south->north). -
getWidth(){number}
-
Returns selected range width (in number of columns excluding columns' headers).
Returns: {number}
-
includes(cellCoords){boolean}
-
Checks if given cell coordinates are within
from
andto
cell coordinates of this range.Parameters:
Name Type Description cellCoords
CellCoords The cell coordinates to check.
Returns: {boolean}
-
includesRange(cellRange){boolean}
-
Checks if given range is within of this range.
Parameters:
Name Type Description cellRange
CellRange The cells range to check.
Returns: {boolean}
-
isCorner(coords, expandedRange){boolean}
-
Checks if coordinates match to one of the 4th corners of this range.
Parameters:
Name Type Description coords
CellCoords Cell coordinates to check.
expandedRange
CellRange optional The cells range to compare with.
Returns: {boolean}
-
isEqual(cellRange){boolean}
-
Checks if given range is equal to this range.
Parameters:
Name Type Description cellRange
CellRange The cells range to check.
Returns: {boolean}
-
isNorthWestOf(cellRange){boolean}
-
Checks if tested coordinates are positioned in north-west from this cell range.
Parameters:
Name Type Description cellRange
CellRange The cells range to check.
Returns: {boolean}
-
isOverlappingHorizontally(cellRange){boolean}
-
Returns
true
if the provided range is overlapping the current range horizontally (e.g. The current range's last
column is 5 and the provided range's first column is 3).Parameters:
Name Type Description cellRange
CellRange The cells range to check.
Returns: {boolean}
-
isOverlappingVertically(cellRange){boolean}
-
Returns
true
if the provided range is overlapping the current range vertically (e.g. The current range's last
row is 5 and the provided range's first row is 3).Parameters:
Name Type Description cellRange
CellRange The cells range to check.
Returns: {boolean}
-
isSingle(){boolean}
-
Checks if this cell range is restricted to one cell.
Returns: {boolean}
-
isSouthEastOf(cellRange){boolean}
-
Checks if tested coordinates are positioned in south-east from this cell range.
Parameters:
Name Type Description cellRange
CellRange The cells range to check.
Returns: {boolean}
-
isValid(wot){boolean}
-
Checks if given coordinates are valid in context of a given Walkontable instance.
Parameters:
Name Type Description wot
Walkontable The Walkontable instance.
Returns: {boolean}
-
overlaps(cellRange){boolean}
-
Checks if tested range overlaps with the range. Range A is considered to to be overlapping with range B
if intersection of A and B or B and A is not empty.Parameters:
Name Type Description cellRange
CellRange The cells range to check.
Returns: {boolean}
-
setDirection(direction)
-
Sets the direction of the selection.
Parameters:
Name Type Description direction
string One of the values:
'NW-SE'
,'NE-SW'
,'SE-NW'
,'SW-NE'
. -
setFrom(coords){CellRange}
-
Set the new coordinates where selection starts from.
Parameters:
Name Type Description coords
CellCoords Coordinates to use.
Returns: {CellRange}
-
setHighlight(coords){CellRange}
-
Set the new coordinates for highlighting selection.
Parameters:
Name Type Description coords
CellCoords Coordinates to use.
Returns: {CellRange}
-
setTo(coords){CellRange}
-
Set new coordinates where selection ends from.
Parameters:
Name Type Description coords
CellCoords Coordinates to use.
Returns: {CellRange}
-
toObject(){object}
-
Convert CellRange to literal object.
Returns: {object} Returns a literal object with
from
andto
properties which each of that object
containsrow
andcol
keys.