Name
Name class
Represents a defined name for a range of cells.
class Name;
Example
const { Workbook } = require("aspose.cells.node");
//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
workbook.save("output/Name.xls");
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 |
|---|---|
| getComment() | @deprecated. Please use the ‘comment’ property instead. Gets and sets the comment of the name. Only applies for Excel 2007 or higher versions. |
| setComment(string) | @deprecated. Please use the ‘comment’ property instead. Gets and sets the comment of the name. Only applies for Excel 2007 or higher versions. |
| getText() | @deprecated. Please use the ’text’ property instead. Gets the name text of the object. |
| setText(string) | @deprecated. Please use the ’text’ property instead. Gets the name text of the object. |
| getFullText() | @deprecated. Please use the ‘fullText’ property instead. Gets the name full text of the object with the scope setting. |
| getRefersTo() | @deprecated. Please use the ‘refersTo’ property instead. Returns or sets the formula that the name is defined to refer to, beginning with an equal sign. |
| setRefersTo(string) | @deprecated. Please use the ‘refersTo’ property instead. Returns or sets the formula that the name is defined to refer to, beginning with an equal sign. |
| getR1C1RefersTo() | @deprecated. Please use the ‘r1C1RefersTo’ property instead. Gets or sets a R1C1 reference of the Name. |
| setR1C1RefersTo(string) | @deprecated. Please use the ‘r1C1RefersTo’ property instead. Gets or sets a R1C1 reference of the Name. |
| isReferred() | @deprecated. Please use the ‘isReferred’ property instead. Indicates whether this name is referred by other formulas. |
| isVisible() | @deprecated. Please use the ‘isVisible’ property instead. Indicates whether the name is visible. |
| setIsVisible(boolean) | @deprecated. Please use the ‘isVisible’ property instead. Indicates whether the name is visible. |
| getSheetIndex() | @deprecated. Please use the ‘sheetIndex’ property instead. Indicates this name belongs to Workbook or Worksheet. 0 = Global name, otherwise index to sheet (one-based) |
| setSheetIndex(number) | @deprecated. Please use the ‘sheetIndex’ property instead. Indicates this name belongs to Workbook or Worksheet. 0 = Global name, otherwise index to sheet (one-based) |
| 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. |
| isNull() | Checks whether the implementation object is null. |
| 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;
getComment()
@deprecated. Please use the ‘comment’ property instead. Gets and sets the comment of the name. Only applies for Excel 2007 or higher versions.
getComment() : string;
setComment(string)
@deprecated. Please use the ‘comment’ property instead. Gets and sets the comment of the name. Only applies for Excel 2007 or higher versions.
setComment(value: string) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | string | The value to set. |
getText()
@deprecated. Please use the ’text’ property instead. Gets the name text of the object.
getText() : string;
setText(string)
@deprecated. Please use the ’text’ property instead. Gets the name text of the object.
setText(value: string) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | string | The value to set. |
getFullText()
@deprecated. Please use the ‘fullText’ property instead. Gets the name full text of the object with the scope setting.
getFullText() : string;
getRefersTo()
@deprecated. Please use the ‘refersTo’ property instead. Returns or sets the formula that the name is defined to refer to, beginning with an equal sign.
getRefersTo() : string;
setRefersTo(string)
@deprecated. Please use the ‘refersTo’ property instead. Returns or sets the formula that the name is defined to refer to, beginning with an equal sign.
setRefersTo(value: string) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | string | The value to set. |
getR1C1RefersTo()
@deprecated. Please use the ‘r1C1RefersTo’ property instead. Gets or sets a R1C1 reference of the Name.
getR1C1RefersTo() : string;
setR1C1RefersTo(string)
@deprecated. Please use the ‘r1C1RefersTo’ property instead. Gets or sets a R1C1 reference of the Name.
setR1C1RefersTo(value: string) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | string | The value to set. |
isReferred()
@deprecated. Please use the ‘isReferred’ property instead. Indicates whether this name is referred by other formulas.
isReferred() : boolean;
isVisible()
@deprecated. Please use the ‘isVisible’ property instead. Indicates whether the name is visible.
isVisible() : boolean;
setIsVisible(boolean)
@deprecated. Please use the ‘isVisible’ property instead. Indicates whether the name is visible.
setIsVisible(value: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean | The value to set. |
getSheetIndex()
@deprecated. Please use the ‘sheetIndex’ property instead. Indicates this name belongs to Workbook or Worksheet. 0 = Global name, otherwise index to sheet (one-based)
getSheetIndex() : number;
setSheetIndex(number)
@deprecated. Please use the ‘sheetIndex’ property instead. Indicates this name belongs to Workbook or Worksheet. 0 = Global name, otherwise index to sheet (one-based)
setSheetIndex(value: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | number | The value to set. |
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.
isNull()
Checks whether the implementation object is null.
isNull() : boolean;
toString()
Returns a string represents the current Range object.
toString() : string;