Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Description

Excerpt

A NamedObject object may refer to an array, number, picture, or range. To create a NamedObject in an Excel file, use the corresponding method for the specific object you wish to create (Pictures.CreatePicture(), Workbook.CreateRange(), etc). To get a NamedObject from an existing file, use Workbook.GetNamedObject(), passing in the name of the object you wish to get.

{signature}

{example}
The following sample gets a {{NamedObject}} from a [Workbook|Workbook].
{code:csharp|title=C#}
          ExcelApplication xla = new ExcelApplication();
          Workbook wb = xla.Open(@"C:\MySpreadsheet.xls");
          NamedObject namedObj = wb.GetNamedObject("MyNamedObject");
{code}
{code:vbnet|title=vb.net
}
          Dim xla As New ExcelApplication()
          Dim wb As Workbook = xla.Open("C:\MySpreadsheet.xls")
          Dim namedObj As NamedObject = wb.GetNamedObject("MyNamedObject")
Signature
C#C#
Wiki Markup
{description}
{excerpt}A {{NamedObject}} object may refer to an array, number, picture, or range. To create a {{NamedObject}} in an Excel file, use the corresponding method for the specific object you wish to create \([Pictures.CreatePicture\(\)|Pictures.CreatePicture], [Workbook.CreateRange\(\)|Workbook.CreateRange], etc\).  To get a {{NamedObject}} from an existing file, use [Workbook.GetNamedObject\(\)|Workbook.GetNamedObject(String)], passing in the name of the object you wish to get.
{excerpt}

{signature:C#}
 public sealed class NamedObject
Signature
{signature}{signature:vb.net
vb.net
}
Public NotInheritable Class NamedObject
Example

The following sample gets a NamedObject from a Workbook.

Code Block
csharpcsharp
titleC#
Code Block
vbnetvbnettitle
Properties

...

Name

...

Description

...

Formula

...

Name

...

NamedObjectType

...

NameScope

...

Value

...

Classes

...

Name

...

Description

...

BuiltInName

...

ReturnType

...

Scope

...

Remarks

Named objects with type ReturnType.Range can also be accessed (as Range objects) through the Workbook.GetNamedRange and Worksheet.GetNamedRange methods. These objects will change their value like other ranges in response to adding or deleting rows, and other similar actions.

Named objects with type ReturnType.Formula and ReturnType.ExternalReference, though they may contain formulas with cell references, will not respond to such actions.
{code}
{example}


{properties}
||Name||Description||
|[Formula|NamedObject.Formula]|{excerpt-include:NamedObject.Formula|nopanel=true}|
|[Name|NamedObject.Name]|{excerpt-include:NamedObject.Name|nopanel=true}|
|[NamedObjectType|NamedObject.NamedObjectType]|{excerpt-include:NamedObject.NamedObjectType|nopanel=true}|
|[NameScope|NamedObject.NameScope]|{excerpt-include:NamedObject.NameScope|nopanel=true}|
|[Value|NamedObject.Value]|{excerpt-include:NamedObject.Value|nopanel=true}|
{classes}
||Name||Description||
|[BuiltInName|NamedObject.BuiltInName]|{excerpt-include:NamedObject.BuiltInName|nopanel=true}|
|[ReturnType|NamedObject.ReturnType]|{excerpt-include:NamedObject.ReturnType|nopanel=true}|
|[Scope|NamedObject.Scope]|{excerpt-include:NamedObject.Scope|nopanel=true}|

{remarks}
Named objects with type {{ReturnType.Range}} can also be accessed (as {{Range}} objects) through the {{Workbook.GetNamedRange}} and {{Worksheet.GetNamedRange}} methods.  These objects will change their value like other ranges in response to adding or deleting rows, and other similar actions.  

Named objects with type {{ReturnType.Formula}} and {{ReturnType.ExternalReference}}, though they may contain formulas with cell references, will not respond to such actions.
{remarks}