Discrepancies Between Word and Aspose Words Java in date fields with locales

I have a word document (docx) with two different date fields with two different languages (german and english). I have inserted them with Insert → Date and Time → And choose a format and language.
In Word it is shown as “18. März 2024” (german) and “18 March 2024” (english).
When using aspose Words Java (24.3) to save the Word to PDF it shows all dates in german.

Do i miss something here or is it a misbehaviour in aspose?
Date.docx (14.7 KB)

@benjamin.schueller By default Aspose.Words uses the current thread locale to format field values upon updating. In your case you should configure Aspose.Words to use field code culture to format field values upon updating.

Document doc = new Document("C:\\Temp\\in.docx");
doc.getFieldOptions().setFieldUpdateCultureSource(FieldUpdateCultureSource.FIELD_CODE);
doc.save("C:\\Temp\\out.pdf");

Great. It works. Thanks for this very fast and helpful answer!

1 Like