[]
Represents a collection of IName objects that store defined names.
Each IName object represents a defined name for a cell, cell range, formula, or constant. Names can be either built-in names, such as Database, Print_Area, and Auto_Open, or custom names created in workbook or worksheet scope.
public interface INames
Public Interface INames
INames names = workbook.Names;
names.Add("SalesData", "=A1:B3");
IName salesData = names["SalesData"];
| Name | Description |
|---|---|
| Count | Returns the number of objects in the collection. For an INames collection, the objects are defined names. |
| this[int] | Returns the IName object from a collection. Use the zero-based index of the defined name in this collection to retrieve a specific name object. |
| this[string] | Returns the IName object from a collection. Use this indexer to retrieve a defined name by its name. |
| Name | Description |
|---|---|
| Add(string, string) | Defines a new name. Returns the IName object.
Uses A1-style notation in |
| Clear() | Clears the IName collection. Removes all defined names from this collection, including names in the current workbook or worksheet scope represented by this INames instance. |
| Contains(string) | Determines whether name is contained in INames. Use this method to check whether the collection already includes a defined name before retrieving it with this[string] or adding a new one. |
| FromJson(string) | Generates a collection of defined name from the JSON string. Use this method to import defined names into the collection from JSON data, such as data previously generated by ToJson(). |
| ToJson() | Generates the JSON string from the defined names. The returned string serializes the current collection of defined names and can be used with FromJson(string) to restore the collection later. |