public void PropertyTypes()
{
//ExStart
//ExFor:DocumentProperty.Type
//ExFor:DocumentProperty.ToBool
//ExFor:DocumentProperty.ToInt
//ExFor:DocumentProperty.ToDouble
//ExFor:DocumentProperty.ToString
//ExFor:DocumentProperty.ToDateTime
//ExFor:PropertyType
//ExSummary:Retrieves the types and values of the custom document properties.
Document doc = new Document(MyDir + "Properties.doc");
foreach (DocumentProperty prop in doc.CustomDocumentProperties)
{
Console.WriteLine(prop.Name);
switch (prop.Type)
{
case PropertyType.String:
Console.WriteLine("It's a string value.");
Console.WriteLine(prop.ToString());
break;
case PropertyType.Boolean:
Console.WriteLine("It's a boolean value.");
Console.WriteLine(prop.ToBool());
break;
case PropertyType.Number:
Console.WriteLine("It's an integer value.");
Console.WriteLine(prop.ToInt());
break;
case PropertyType.DateTime:
Console.WriteLine("It's a date time value.");
Console.WriteLine(prop.ToDateTime());
break;
case PropertyType.Double:
Console.WriteLine("It's a double value.");
Console.WriteLine(prop.ToDouble());
break;
case PropertyType.Other:
Console.WriteLine("Other value.");
break;
default:
throw new Exception("Unknown property type.");
}
}
//ExEnd
}
}