HotXLS dokumentáció

Add metódus

Defines a new name. Visszaad IXLSName Interface

Szintaxis

function Add(Name: Widestring; RefersTo: Widestring): IXLSName;
function Add(Name: Widestring; RefersTo: Widestring; Visible: Boolean): IXLSName;
function Add(Name: Widestring; SheetName: Widestring; sor: Integer; Col: Integer): IXLSName;
function Add(Name: Widestring; SheetName: Widestring; Row1: Integer; Col1: Integer; Row2: Integer; Col2: Integer): IXLSName;
Name Required Widestring. The text to use as the name. Names cannot include spaces and cannot look like cella references
RefersTo Required Widestring. Describes what the name refers to (using A1-style notation)
Visible Optional Boolean. True to define the name normally. False to define the name as a hidden name (that is, it doesn't appear in either the Define Name, Paste Name, or Goto dialog box). The alapértelmezett érték is True
SheetName Required Widestring. The munkalap that owns the target cella or tartomány
Row Required Integer. The one-based sor for a single-cella target
Col Required Integer. The one-based oszlop for a single-cella target
Row1, Col1, Row2, Col2 Required Integers. The one-based sor and oszlop coordinates for a rectangular target tartomány

Példa

Ez a példa adds new defined name for the munkafüzet and use this name in the cella képlet

Workbook.Names.Add('MyName','=Sheet1!$F$10:$H$20');
Workbook.Sheets[1].Cells[3,4].Formula := '=SUM(MyName)';
Ez a példa creates single-cella and tartomány names from munkalap coordinates

Workbook.Names.Add('InputCell','Sheet1',2,3);
Workbook.Names.Add('InputBlock','Sheet1',4,2,6,5);
Ez a példa adds new defined name for the munkalap one and use this name in the cella képlet

Workbook.Sheets[1].Names.Add('MyName','=Sheet1!$F$10:$H$20');
Workbook.Sheets[2].Cells[3,4].Formula := '=SUM(Sheet1!MyName)';

Lásd még