ToDouble
DocumentProperty.ToDouble method
Returns the property value as double.
public double ToDouble()
Remarks
Throws an exception if the property type is not Number.
Examples
Shows various type conversion methods of custom document properties.
Document doc = new Document();
CustomDocumentProperties properties = doc.CustomDocumentProperties;
DateTime authDate = DateTime.Today;
properties.Add("Authorized", true);
properties.Add("Authorized By", "John Doe");
properties.Add("Authorized Date", authDate);
properties.Add("Authorized Revision", doc.BuiltInDocumentProperties.RevisionNumber);
properties.Add("Authorized Amount", 123.45);
Assert.AreEqual(true, properties["Authorized"].ToBool());
Assert.AreEqual("John Doe", properties["Authorized By"].ToString());
Assert.AreEqual(authDate, properties["Authorized Date"].ToDateTime());
Assert.AreEqual(1, properties["Authorized Revision"].ToInt());
Assert.AreEqual(123.45d, properties["Authorized Amount"].ToDouble());
See Also
- class DocumentProperty
- namespace Aspose.Words.Properties
- assembly Aspose.Words