Defines a new name. برمیگرداند
IXLSName Interface
نحو
function Add(Name: Widestring; RefersTo: Widestring):
IXLSName;
function Add(Name: Widestring; RefersTo: Widestring; Visible: Boolean):
IXLSName;
function Add(Name: Widestring; SheetName: Widestring; ردیف: 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 سلول 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 مقدار پیشفرض is True |
| SheetName |
Required Widestring. The کاربرگ that owns the target سلول or محدوده |
| Row |
Required Integer. The one-based ردیف for a single-سلول target |
| Col |
Required Integer. The one-based ستون for a single-سلول target |
| Row1, Col1, Row2, Col2 |
Required Integers. The one-based ردیف and ستون coordinates for a rectangular target محدوده |
نمونه
این نمونه adds new defined name for the کارپوشه and use this name in the سلول فرمول
Workbook.Names.Add('MyName','=Sheet1!$F$10:$H$20');
Workbook.Sheets[1].Cells[3,4].Formula := '=SUM(MyName)';
این نمونه creates single-سلول and محدوده names from کاربرگ coordinates
Workbook.Names.Add('InputCell','Sheet1',2,3);
Workbook.Names.Add('InputBlock','Sheet1',4,2,6,5);
این نمونه adds new defined name for the کاربرگ one and use this name in the سلول فرمول
Workbook.Sheets[1].Names.Add('MyName','=Sheet1!$F$10:$H$20');
Workbook.Sheets[2].Cells[3,4].Formula := '=SUM(Sheet1!MyName)';
همچنین ببینید