Class DocumentProperty

DocumentProperty class

Represents a custom or built-in document property.

public class DocumentProperty

Properties

NameDescription
IsGeneratedName { get; }Returns true if this property does not have a name in the OLE2 storage and a unique name was generated only for the public API.
IsLinkedToContent { get; }Indicates whether this property is linked to content
Name { get; }Returns the name of the property.
Source { get; }The linked content source.
Type { get; }Gets the data type of the property.
Value { get; set; }Gets or sets the value of the property.

Methods

NameDescription
ToBool()Returns the property value as bool.
ToDateTime()Returns the property value as DateTime in local timezone.
ToDouble()Returns the property value as double.
ToInt()Returns the property value as integer.
override ToString()Returns the property value as a string.

Examples


[C#]

//Instantiate a Workbook object
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
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