Class DocumentProperty

Class DocumentProperty

Namespace: Aspose.Cells.Properties
Assembly: Aspose.Cells.dll (25.2.0)

Represents a custom or built-in document property.

public class DocumentProperty

Inheritance

objectDocumentProperty

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

csharp
[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"];

'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")

Properties

IsGeneratedName

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.

public bool IsGeneratedName { get; }

Property Value

bool

IsLinkedToContent

Indicates whether this property is linked to content

public bool IsLinkedToContent { get; }

Property Value

bool

Name

Returns the name of the property.

public string Name { get; }

Property Value

string

Source

The linked content source.

public string Source { get; }

Property Value

string

Type

Gets the data type of the property.

public PropertyType Type { get; }

Property Value

PropertyType

Value

Gets or sets the value of the property.

public object Value { get; set; }

Property Value

object

Methods

ToBool()

Returns the property value as bool.

public bool ToBool()

Returns

bool

Remarks

Throws an exception if the property type is not PropertyType.Boolean.

ToDateTime()

Returns the property value as DateTime in local timezone.

public DateTime ToDateTime()

Returns

DateTime

Remarks

Throws an exception if the property type is not PropertyType.Date.

ToDouble()

Returns the property value as double.

public double ToDouble()

Returns

double

Remarks

Throws an exception if the property type is not PropertyType.Float.

ToInt()

Returns the property value as integer.

public int ToInt()

Returns

int

Remarks

Throws an exception if the property type is not PropertyType.Number.

ToString()

Returns the property value as a string.

public override string ToString()

Returns

string

Remarks

Converts a number property using Object.ToString(). Converts a boolean property into "Y" or "N". Converts a date property into a short date string.