DocumentProperty Class

Represents a custom or built-in document property.
Inheritance Hierarchy
SystemObject
  Aspose.Words.PropertiesDocumentProperty

Namespace:  Aspose.Words.Properties
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public class DocumentProperty

The DocumentProperty type exposes the following members.

Properties
  NameDescription
Public propertyCode exampleIsLinkToContent
Shows whether this property is linked to content or not.
Public propertyCode exampleLinkSource
Gets the source of a linked custom document property.
Public propertyCode exampleName
Returns the name of the property.
Public propertyCode exampleType
Gets the data type of the property.
Public propertyCode exampleValue
Gets or sets the value of the property.
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodCode exampleToBool
Returns the property value as bool.
Public methodCode exampleToByteArray
Returns the property value as byte array.
Public methodCode exampleToDateTime
Returns the property value as DateTime in UTC.
Public methodCode exampleToDouble
Returns the property value as double.
Public methodCode exampleToInt
Returns the property value as integer.
Public methodCode exampleToString
Returns the property value as a string formatted according to the current locale.
(Overrides ObjectToString.)
Remarks
Examples
Enumerates through all built-in and custom properties in a document using indexed access.
Document doc = new Document(MyDir + "Properties.docx");

Console.WriteLine("1. Document name: {0}", doc.OriginalFileName);

Console.WriteLine("2. Built-in Properties");
for (int i = 0; i < doc.BuiltInDocumentProperties.Count; i++)
{
    DocumentProperty docProperty = doc.BuiltInDocumentProperties[i];
    Console.WriteLine("{0}({1}) : {2}", docProperty.Name, docProperty.Type, docProperty.Value);
}

Console.WriteLine("3. Custom Properties");
for (int i = 0; i < doc.CustomDocumentProperties.Count; i++)
{
    DocumentProperty docProperty = doc.CustomDocumentProperties[i];
    Console.WriteLine("{0}({1}) : {2}", docProperty.Name, docProperty.Type, docProperty.Value);
}
See Also