How should a Date type DocProperty be set?

Word document template has a DocProperty defined as Date type. Setting java.util.Date value to com.aspose.words.DocumentProperty will lead to undesired behaviour:

- DocumentProperty PropertyType.DATE_TIME changes to PropertyType.OTHER

- Word document cannot be saved anymore: SEVERE: java.lang.UnsupportedOperationException: Do not know how to write a property value of this type.

I need to preserve the original Date type DocProperty; setting the date as String works but changes the DocProperty type to Text. I’m stuck and can’t find any help in Aspose.Words documentation. Please feel free to give some useful advice here.

Aspose.Words for Java 3.3 & 3.21 tested here.



Thanks for your request. Could you please attach sample document and provide me simple code example, which will allow me to reproduce the problem on my side? I will check the issue and provide you more information.
Best regards.

Sorry for delayed reply, I was having some time off for the New Year…
A sample document is attached and a simple test code to reproduce the problem follows here:

public void testForAsposeForum() throws Exception
    String value = "2.1.2010";
    SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy");

    Document doc = new Document("C:/DATA/test/mditest_types.doc");
    DocumentProperty property = doc.getCustomDocumentProperties().get("prop_date");

    System.out.println("property.getType() = " + property.getType() +
            " - propertyname=" + property.getName());
    switch (property.getType())
        case PropertyType.STRING:
        case PropertyType.DATE_TIME:
            Date d = formatter.parse(value);
            System.out.println("DATE=" + d.toString());
            System.out.println("DATE2=" + property.getValue());
            System.out.println("IS IT A DATE? property.getType() = " +
                    property.getType() + " - propertyname=" +

    } catch (Exception e)
        throw e;


And here’s the output of the test program:

property.getType() = 1 - propertyname = prop_date
DATE=Sat Jan 02 00:00:00 EET 2010
DATE2=Sat Jan 02 00:00:00 EET 2010
IS IT A DATE ? property.getType() = 7 - propertyname = prop_date

java.lang.UnsupportedOperationException: Do not know how to write a property value of this type.
at asposewobfuscated.le.a(
at asposewobfuscated.le.toByteArray(
at 231)
at 146)
at 27)
at com.aspose.words.Document.a( 1494)
at 907)
at 881)


Thank you for additional information. I managed to reproduce the problem on my side. You will be notified as soon as the issue is resolved.
Maybe you can just specify string as a value of the property:

Document doc = new Document("C:\\Temp\\in.doc");

Best regards.

Setting a string as a value will change the DocProperty type as text. I need to retain the date type DocProperty.


Thank you for additional information. In this case you should wait for a fix. I will notify you as soon as the issues is resolved.
Best regards.


We should be going in production shortly with our Aspose.Words implementation. I would like to know when the fix for this issue will be available. Could you provide some estimate please?



Thanks for your inquiry. This issue is already fixed in the latest version of Aspose.Words for Java (4.0.1). You can download it from here:

Best regards,

The issues you have found earlier (filed as 13293) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.