Date formatting when converting to DOCX to PDF

Hi, i have he following problem:



i read a docx and save it as pdf, but the DATE fields are formatted in the the Java Systems locale, how can i change this to

1. keep the locale as created (preferred way)

2. use any locale (without Locale.setDefault()!)



Best regards

I tried the following:



document.getFieldOptions().setFieldUpdateCultureSource(FieldUpdateCultureSource.FIELD_CODE);

NodeCollection collection = document.getChildNodes(NodeType.RUN, true);

for(Run run:collection){

run.getFont().setLocaleId(1031);

}





but no success

Hi there,

Thanks for your inquiry. Please use the new CurrentThreadSettings class to set ThreadLocal or/and ThreadLocal before open/save a document with non-default locale settings. Hope, this helps.

Thank you, this works. I assume that this does not influence the systems default locale.



Is is possible to retain the original locale? Or to query the original locale?



Best regards

Joachim

Hi Joachim,

Thanks for your inquiry. You need to get the original Locale before setting ThreadLocal and use it according to your requirements. Please use CurrentThreadSettings.getThreadLocaleOrDefault() method. Hope this helps you.