Aspose::Cells::Name class

Name class

Represents a defined name for a range of cells.

class Name

Methods

MethodDescription
GetComment()Gets and sets the comment of the name. Only applies for Excel 2007 or higher versions.
GetFullText()Gets the name full text of the object with the scope setting.
GetR1C1RefersTo()Gets or sets a R1C1 reference of the Name.
GetRange()Gets the range if this name refers to a range.
GetRange(bool recalculate)Gets the range if this name refers to a range.
GetRange(int32_t sheetIndex, int32_t row, int32_t column)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.
GetRanges()Gets all ranges referred by this name.
GetRanges(bool recalculate)Gets all ranges referred by this name.
GetReferredAreas(bool recalculate)Gets all references referred by this name.
GetRefersTo()Returns or sets the formula that the name is defined to refer to, beginning with an equal sign.
GetRefersTo(bool isR1C1, bool isLocal)Get the reference of this Name.
GetRefersTo(bool isR1C1, bool isLocal, int32_t row, int32_t column)Get the reference of this Name based on specified cell.
GetSheetIndex()Indicates this name belongs to Workbook or Worksheet. 0 = Global name, otherwise index to sheet (one-based)
GetText()Gets the name text of the object.
IsNull() constChecks whether the implementation object is nullptr.
IsReferred()Indicates whether this name is referred by other formulas.
IsVisible()Indicates whether the name is visible.
Name(Name_Impl* impl)Constructs from an implementation object.
Name(const Name& src)Copy constructor.
explicit operator bool() constoperator bool()
operator=(const Name& src)operator=
SetComment(const U16String& value)Gets and sets the comment of the name. Only applies for Excel 2007 or higher versions.
SetComment(const char16_t* value)Gets and sets the comment of the name. Only applies for Excel 2007 or higher versions.
SetIsVisible(bool value)Indicates whether the name is visible.
SetR1C1RefersTo(const U16String& value)Gets or sets a R1C1 reference of the Name.
SetR1C1RefersTo(const char16_t* value)Gets or sets a R1C1 reference of the Name.
SetRefersTo(const U16String& value)Returns or sets the formula that the name is defined to refer to, beginning with an equal sign.
SetRefersTo(const char16_t* value)Returns or sets the formula that the name is defined to refer to, beginning with an equal sign.
SetRefersTo(const U16String& refersTo, bool isR1C1, bool isLocal)Set the reference of this Name.
SetRefersTo(const char16_t* refersTo, bool isR1C1, bool isLocal)Set the reference of this Name.
SetSheetIndex(int32_t value)Indicates this name belongs to Workbook or Worksheet. 0 = Global name, otherwise index to sheet (one-based)
SetText(const U16String& value)Gets the name text of the object.
SetText(const char16_t* value)Gets the name text of the object.
ToString()Returns a string represents the current Range object.
~Name()Destructor.

Fields

FieldDescription
_implThe implementation object.

Examples

Aspose::Cells::Startup();
//Instantiating a Workbook object
Workbook workbook;
//Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.GetWorksheets().Get(0);
//Creating a named range
Range range = worksheet.GetCells().CreateRange(u"B4", u"G14");
//Setting the name of the named range
range.SetName(u"TestRange");
//Saving the modified Excel file in default (that is Excel 2000) format
workbook.Save(u"output.xls");

Aspose::Cells::Cleanup();

See Also