Dokumentace HotXLS

Add metoda

Defines a new name. Vrací IXLSName Interface

Syntaxe

function Add(Name: Widestring; RefersTo: Widestring): IXLSName;
function Add(Name: Widestring; RefersTo: Widestring; Visible: Boolean): IXLSName;
function Add(Name: Widestring; SheetName: Widestring; řádek: 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 buňka 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 výchozí hodnota is True
SheetName Required Widestring. The list that owns the target buňka or oblast
Row Required Integer. The one-based řádek for a single-buňka target
Col Required Integer. The one-based sloupec for a single-buňka target
Row1, Col1, Row2, Col2 Required Integers. The one-based řádek and sloupec coordinates for a rectangular target oblast

Příklad

Tento příklad adds new defined name for the sešit and use this name in the buňka vzorec

Workbook.Names.Add('MyName','=Sheet1!$F$10:$H$20');
Workbook.Sheets[1].Cells[3,4].Formula := '=SUM(MyName)';
Tento příklad creates single-buňka and oblast names from list coordinates

Workbook.Names.Add('InputCell','Sheet1',2,3);
Workbook.Names.Add('InputBlock','Sheet1',4,2,6,5);
Tento příklad adds new defined name for the list one and use this name in the buňka vzorec

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

Viz také