Mail merge generates incorrect output for date field using Java

In my word document I have a merge field like this (inserted using alt-f9 & ctrl-f9):

{MERGEFIELD Invoice.Date \@ “dd.MM.yyyy” \* MERGEFORMAT}

It seems the formating is not taken account. I always get the date formatted as “Sat Mar 05 00:00:00
CET 2011” in my output PDF.

What am I doing from? :slight_smile:

Thanks,
Corin

BTW: Is it also somehow possible to simply pass a string object with ex. “2011-06-02” instead of having to use SimpleDateFormat to convert into a Date instance?

Hi there,
In regards to your last query, you should be able to merge the date using a simple string as well. If you have any troubles, please feel free to ask.
Thanks,

The issues you have found earlier (filed as WORDSJAVA-1) have been fixed in this .NET update and in this Java update.

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

Hi
Thanks for your request. I rechecked with the latest version and everything works as expected on my side. Here I my code:

Document doc = new Document("C:\\Temp\\in.docx");
String[] names = {
    "datum"
};
Object[] obj = {
    new java.util.Date()
};
doc.getMailMerge().execute(names, obj);
doc.save("c:\\Temp\\out.doc");
doc.save("c:\\Temp\\out.pdf")

I attached input and output documents.
You can download the latest version of Aspose.Words for Java from here:
https://releases.aspose.com/words/java
Best regards,