Class Name
Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)
Represents a defined name for a range of cells.
public class Name
Inheritance
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Examples
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];
//Creating a named range
Range range = worksheet.Cells.CreateRange("B4", "G14");
//Setting the name of the named range
range.Name = "TestRange";
//Saving the modified Excel file in default (that is Excel 2000) format
workbook.Save("output.xls");
'Instantiating a Workbook object
Dim workbook As Workbook = New Workbook()
'Accessing the first worksheet in the Excel file
Dim worksheet As Worksheet = workbook.Worksheets(0)
'Creating a named range
Dim range As Range = worksheet.Cells.CreateRange("B4", "G14")
'Setting the name of the named range
range.Name = "TestRange"
'Saving the modified Excel file in default (that is Excel 2000) format
workbook.Save("output.xls")
Properties
Comment
Gets and sets the comment of the name. Only applies for Excel 2007 or higher versions.
public string Comment { get; set; }
Property Value
FullText
Gets the name full text of the object with the scope setting.
public string FullText { get; }
Property Value
IsReferred
Indicates whether this name is referred by other formulas.
public bool IsReferred { get; }
Property Value
IsVisible
Indicates whether the name is visible.
public bool IsVisible { get; set; }
Property Value
R1C1RefersTo
Gets or sets a R1C1 reference of the Aspose.Cells.Name.
public string R1C1RefersTo { get; set; }
Property Value
RefersTo
Returns or sets the formula that the name is defined to refer to, beginning with an equal sign.
public string RefersTo { get; set; }
Property Value
SheetIndex
Indicates this name belongs to Workbook or Worksheet. 0 = Global name, otherwise index to sheet (one-based)
public int SheetIndex { get; set; }
Property Value
Text
Gets the name text of the object.
public string Text { get; set; }
Property Value
Methods
GetRange()
Gets the range if this name refers to a range.
public Range GetRange()
Returns
The range.
GetRange(bool)
Gets the range if this name refers to a range
public Range GetRange(bool recalculate)
Parameters
recalculate
bool
whether recalculate it if this name has been calculated before this invocation.
Returns
The range.
GetRange(int, int, int)
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.
public Range GetRange(int sheetIndex, int row, int column)
Parameters
sheetIndex
int
The according sheet index.
row
int
The according row index.
column
int
The according column index
Returns
The range.
GetRanges()
Gets all ranges referred by this name.
public Range[] GetRanges()
Returns
Range[]
All ranges.
GetRanges(bool)
Gets all ranges referred by this name.
public Range[] GetRanges(bool recalculate)
Parameters
recalculate
bool
whether recalculate it if this name has been calculated before this invocation.
Returns
Range[]
All ranges.
GetReferredAreas(bool)
Gets all references referred by this name.
public ReferredArea[] GetReferredAreas(bool recalculate)
Parameters
recalculate
bool
whether recalculate it if this name has been calculated before this invocation.
Returns
All ranges.
GetRefersTo(bool, bool)
Get the reference of this Name.
public string GetRefersTo(bool isR1C1, bool isLocal)
Parameters
isR1C1
bool
Whether the reference needs to be formatted as R1C1.
isLocal
bool
Whether the reference needs to be formatted by locale.
Returns
GetRefersTo(bool, bool, int, int)
Get the reference of this Name based on specified cell.
public string GetRefersTo(bool isR1C1, bool isLocal, int row, int column)
Parameters
isR1C1
bool
Whether the reference needs to be formatted as R1C1.
isLocal
bool
Whether the reference needs to be formatted by locale.
row
int
The row index of the cell.
column
int
The column index of the cell.
Returns
SetRefersTo(string, bool, bool)
Set the reference of this Name.
public void SetRefersTo(string refersTo, bool isR1C1, bool isLocal)
Parameters
refersTo
string
The reference.
isR1C1
bool
Whether the reference is R1C1 format.
isLocal
bool
Whether the reference is locale formatted.
ToString()
Returns a string represents the current Range object.
public override string ToString()