Name class

Name class

Represents a defined name for a range of cells.

The Name type exposes the following members:

Properties

PropertyDescription
commentGets and sets the comment of the name.
Only applies for Excel 2007 or higher versions.
textGets the name text of the object.
full_textGets the name full text of the object with the scope setting.
refers_toReturns or sets the formula that the name is defined to refer to, beginning with an equal sign.
r1c1_refers_toGets or sets a R1C1 reference of the Name.
is_referredIndicates whether this name is referred by other formulas.
is_visibleIndicates whether the name is visible.
sheet_indexIndicates this name belongs to Workbook or Worksheet.
0 = Global name, otherwise index to sheet (one-based)

Methods

MethodDescription
get_refers_toGet the reference of this Name.
get_refers_toGet the reference of this Name based on specified cell.
get_rangesGets all ranges referred by this name.
get_rangesGets all ranges referred by this name.
get_rangeGets the range if this name refers to a range.
get_rangeGets the range if this name refers to a range
get_rangeGets 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.
set_refers_toSet the reference of this Name.
get_referred_areasGets all references referred by this name.

Example

from aspose.cells import Workbook

# Instantiating a Workbook object
workbook = Workbook()
# Accessing the first worksheet in the Excel file
worksheet = workbook.worksheets[0]
# Creating a named range
range = worksheet.cells.create_range("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")

See Also