DocumentPropertyCollection

DocumentPropertyCollection class

Base class for BuiltInDocumentPropertyCollection and CustomDocumentPropertyCollection collections.

public abstract class DocumentPropertyCollection : IEnumerable

Properties

Name Description
Count { get; } Gets number of items in the collection.
Item { get; } Returns a DocumentProperty object by index.
virtual Item { get; } Returns a DocumentProperty object by the name of the property.

Methods

Name Description
Clear() Removes all properties from the collection.
Contains(string) Returns true if a property with the specified name exists in the collection.
GetEnumerator()
IndexOf(string) Gets the index of a property by name.
Remove(string) Removes a property with the specified name from the collection.
RemoveAt(int) Removes a property at the specified index.

Examples


[C#]

//Instantiate a Workbook object by calling its empty constructor
Workbook workbook = new Workbook("book1.xls");
 
//Retrieve a list of all custom document properties of the Excel file
DocumentPropertyCollection customProperties = workbook.Worksheets.CustomDocumentProperties;
 
//Accessng a custom document property by using the property index
DocumentProperty customProperty1 = customProperties[3];
 
//Accessng a custom document property by using the property name
DocumentProperty customProperty2 = customProperties["Owner"];

[VB.NET]

'Instantiate a Workbook object by calling its empty constructor
Dim workbook As Workbook = New Workbook("book1.xls")
 
'Retrieve a list of all custom document properties of the Excel file
Dim customProperties As DocumentPropertyCollection = workbook.Worksheets.CustomDocumentProperties
 
'Accessng a custom document property by using the property index
Dim customProperty1 As DocumentProperty = customProperties(3)
 
'Accessng a custom document property by using the property name
Dim customProperty2 As DocumentProperty = customProperties("Owner")

See Also