TXLSXDefinedNames owns workbook and worksheet scoped Excel names through TXLSXWorkbook.DefinedNames and each item is a TXLSXDefinedName declared in lxHandleX
Declarations
type
TXLSXDefinedName = class
constructor Create(const AName, AFormula: WideString; ASheetIndex: Integer = -1);
property Name: WideString;
property Formula: WideString;
property SheetIndex: Integer;
property Visible: Boolean;
property Hidden: Boolean;
property Comment: WideString;
end;
TXLSXDefinedNames = class
function Add(const AName, AFormula: WideString): Integer; overload;
function Add(const AName, AFormula: WideString; ASheetIndex: Integer): Integer; overload;
function FindByName(const AName: WideString): TXLSXDefinedName; overload;
function FindByName(const AName: WideString; ASheetIndex: Integer): TXLSXDefinedName; overload;
function DeleteByName(const AName: WideString): Boolean; overload;
procedure Delete(Index: Integer);
procedure Clear;
property Count: Integer;
property Items[Index: Integer]: TXLSXDefinedName; default;
end;
Key members
| Formula | Formula or range reference stored without a leading equals sign |
| SheetIndex | -1 creates a workbook name and a zero-based sheet index creates a local name |
| Visible and Hidden | Complementary views of the Excel Name Manager hidden attribute |
| Comment | Optional note persisted in the OOXML defined-name metadata |
| FindByName | Yields nil when no matching name exists in the requested scope |
Example
Workbook.DefinedNames.Add('SalesTotal', 'Sheet1!$B$2:$B$13');
Workbook.DefinedNames.Add('LocalRate', '$D$2', 0);
Workbook.DefinedNames.FindByName('SalesTotal').Comment := 'Monthly sales range';
See also