Name
Name class
Represents a defined name for a range of cells.
class Name;
Example
const { Workbook, SaveFormat } = AsposeCells;
//Instantiating a Workbook object
var workbook = new Workbook();
//Accessing the first worksheet in the Excel file
var worksheet = workbook.worksheets.get(0);
//Creating a named range
var range = worksheet.cells.createRange("B4", "G14");
//Setting the name of the named range
range.setName("TestRange");
//Saving the modified Excel file in default (that is Excel 2000) format
var uint8Array = workbook.save(SaveFormat.Xlsx);
Properties
Property | Type | Description |
---|---|---|
comment | string | Gets and sets the comment of the name. Only applies for Excel 2007 or higher versions. |
text | string | Gets the name text of the object. |
fullText | string | Readonly. Gets the name full text of the object with the scope setting. |
refersTo | string | Returns or sets the formula that the name is defined to refer to, beginning with an equal sign. |
r1C1RefersTo | string | Gets or sets a R1C1 reference of the Name. |
isReferred | boolean | Readonly. Indicates whether this name is referred by other formulas. |
isVisible | boolean | Indicates whether the name is visible. |
sheetIndex | number | Indicates this name belongs to Workbook or Worksheet. 0 = Global name, otherwise index to sheet (one-based) |
Methods
Method | Description |
---|---|
getRefersTo(boolean, boolean) | Get the reference of this Name. |
getRefersTo(boolean, boolean, number, number) | Get the reference of this Name based on specified cell. |
setRefersTo(string, boolean, boolean) | Set the reference of this Name. |
getRanges() | Gets all ranges referred by this name. |
getRanges(boolean) | Gets all ranges referred by this name. |
getReferredAreas(boolean) | Gets all references referred by this name. |
getRange() | Gets the range if this name refers to a range. |
getRange(boolean) | Gets the range if this name refers to a range |
getRange(number, number, number) | Gets the range if this name refers to a range. If the reference of this name is not absolute, the range may be different for different cell. |
toString() | Returns a string represents the current Range object. |
comment
Gets and sets the comment of the name. Only applies for Excel 2007 or higher versions.
comment : string;
text
Gets the name text of the object.
text : string;
fullText
Readonly. Gets the name full text of the object with the scope setting.
fullText : string;
refersTo
Returns or sets the formula that the name is defined to refer to, beginning with an equal sign.
refersTo : string;
r1C1RefersTo
Gets or sets a R1C1 reference of the Name.
r1C1RefersTo : string;
isReferred
Readonly. Indicates whether this name is referred by other formulas.
isReferred : boolean;
isVisible
Indicates whether the name is visible.
isVisible : boolean;
sheetIndex
Indicates this name belongs to Workbook or Worksheet. 0 = Global name, otherwise index to sheet (one-based)
sheetIndex : number;
getRefersTo(boolean, boolean)
Get the reference of this Name.
getRefersTo(isR1C1: boolean, isLocal: boolean) : string;
Parameters:
Parameter | Type | Description |
---|---|---|
isR1C1 | boolean | Whether the reference needs to be formatted as R1C1. |
isLocal | boolean | Whether the reference needs to be formatted by locale. |
getRefersTo(boolean, boolean, number, number)
Get the reference of this Name based on specified cell.
getRefersTo(isR1C1: boolean, isLocal: boolean, row: number, column: number) : string;
Parameters:
Parameter | Type | Description |
---|---|---|
isR1C1 | boolean | Whether the reference needs to be formatted as R1C1. |
isLocal | boolean | Whether the reference needs to be formatted by locale. |
row | number | The row index of the cell. |
column | number | The column index of the cell. |
setRefersTo(string, boolean, boolean)
Set the reference of this Name.
setRefersTo(refersTo: string, isR1C1: boolean, isLocal: boolean) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
refersTo | string | The reference. |
isR1C1 | boolean | Whether the reference is R1C1 format. |
isLocal | boolean | Whether the reference is locale formatted. |
getRanges()
Gets all ranges referred by this name.
getRanges() : Range[];
Returns
All ranges.
getRanges(boolean)
Gets all ranges referred by this name.
getRanges(recalculate: boolean) : Range[];
Parameters:
Parameter | Type | Description |
---|---|---|
recalculate | boolean | whether recalculate it if this name has been calculated before this invocation. |
Returns
All ranges.
getReferredAreas(boolean)
Gets all references referred by this name.
getReferredAreas(recalculate: boolean) : ReferredArea[];
Parameters:
Parameter | Type | Description |
---|---|---|
recalculate | boolean | whether recalculate it if this name has been calculated before this invocation. |
Returns
All ranges.
getRange()
Gets the range if this name refers to a range.
getRange() : Range;
Returns
The range.
getRange(boolean)
Gets the range if this name refers to a range
getRange(recalculate: boolean) : Range;
Parameters:
Parameter | Type | Description |
---|---|---|
recalculate | boolean | whether recalculate it if this name has been calculated before this invocation. |
Returns
The range.
getRange(number, number, number)
Gets the range if this name refers to a range. If the reference of this name is not absolute, the range may be different for different cell.
getRange(sheetIndex: number, row: number, column: number) : Range;
Parameters:
Parameter | Type | Description |
---|---|---|
sheetIndex | number | The according sheet index. |
row | number | The according row index. |
column | number | The according column index |
Returns
The range.
toString()
Returns a string represents the current Range object.
toString() : string;