Returns a DocumentProperty object by the name of the property.
[Visual Basic]Overridable Overloads Public Default ReadOnly Property Item( _
ByVal
name As
String _
) As
DocumentProperty Parameters
- name
- The case-insensitive name of the property to retrieve.
Remarks
Returns null if a property with the specified name is not found.
Example
Retrieves a custom document property by name.
[C#]
Document doc = new Document(MyDir + "Properties.doc");
DocumentProperty prop = doc.CustomDocumentProperties["Authorized Date"];
if (prop != null)
{
Console.WriteLine(prop.ToDateTime());
}
else
{
Console.WriteLine("The document is not authorized. Authorizing...");
doc.CustomDocumentProperties.Add("AuthorizedDate", DateTime.Now);
}[Visual Basic]
Dim doc As Document = New Document(MyDir & "Properties.doc")
Dim prop As DocumentProperty = doc.CustomDocumentProperties("Authorized Date")
If Not prop Is Nothing Then
Console.WriteLine(prop.ToDateTime())
Else
Console.WriteLine("The document is not authorized. Authorizing...")
doc.CustomDocumentProperties.Add("AuthorizedDate", DateTime.Now)
End IfSee Also
DocumentPropertyCollection Class | Aspose.Words.Properties Namespace | DocumentPropertyCollection.Item Overload List