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.getWorksheets().get(0);
//Creating a named range
var range = worksheet.getCells().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");
Methods
Method | Description |
---|---|
getComment() | Gets and sets the comment of the name. Only applies for Excel 2007 or higher versions. |
setComment(string) | Gets and sets the comment of the name. Only applies for Excel 2007 or higher versions. |
getText() | Gets the name text of the object. |
setText(string) | Gets the name text of the object. |
getFullText() | Gets the name full text of the object with the scope setting. |
getRefersTo() | Returns or sets the formula that the name is defined to refer to, beginning with an equal sign. |
setRefersTo(string) | Returns or sets the formula that the name is defined to refer to, beginning with an equal sign. |
getR1C1RefersTo() | Gets or sets a R1C1 reference of the Name. |
setR1C1RefersTo(string) | Gets or sets a R1C1 reference of the Name. |
isReferred() | Indicates whether this name is referred by other formulas. |
isVisible() | Indicates whether the name is visible. |
setIsVisible(boolean) | Indicates whether the name is visible. |
getSheetIndex() | Indicates this name belongs to Workbook or Worksheet. 0 = Global name, otherwise index to sheet (one-based) |
setSheetIndex(number) | 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. |
toString() | Returns a string represents the current Range object. |
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. |
getComment()
Gets and sets the comment of the name. Only applies for Excel 2007 or higher versions.
getComment() : string;
setComment(string)
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()
Gets the name text of the object.
getText() : string;
setText(string)
Gets the name text of the object.
setText(value: string) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | string | The value to set. |
getFullText()
Gets the name full text of the object with the scope setting.
getFullText() : string;
getRefersTo()
Returns or sets the formula that the name is defined to refer to, beginning with an equal sign.
getRefersTo() : string;
setRefersTo(string)
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()
Gets or sets a R1C1 reference of the Name.
getR1C1RefersTo() : string;
setR1C1RefersTo(string)
Gets or sets a R1C1 reference of the Name.
setR1C1RefersTo(value: string) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | string | The value to set. |
isReferred()
Indicates whether this name is referred by other formulas.
isReferred() : boolean;
isVisible()
Indicates whether the name is visible.
isVisible() : boolean;
setIsVisible(boolean)
Indicates whether the name is visible.
setIsVisible(value: boolean) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | The value to set. |
getSheetIndex()
Indicates this name belongs to Workbook or Worksheet. 0 = Global name, otherwise index to sheet (one-based)
getSheetIndex() : number;
setSheetIndex(number)
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. |
toString()
Returns a string represents the current Range object.
toString() : string;
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;