We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

DATE/TIME fields have wrong format (culture is ignored) after conversion to PDF



I use Aspose.Words to convert Word documents to PDF.


Recently noticed that Aspose.Words using current thread’s culture to convert DATE/TIME fields. Style settings are ignored. As a result, french date is changed to another (English in my case). See file after converting it to PDF.

Sample file that contains one paragraph with TIME filed. Paragraph style is Normal. Normal style has Canadian French (fr-CA) as a language.

Part of ‘Normal’ style definition from “word\styles.xml”:

<w:style w:type=“paragraph” w:default=“1” w:styleId=“Normal”>
<w:name w:val=“Normal”/>
<w:rsid w:val=“00015C82”/>
<w:spacing w:after=“0” w:line=“240” w:lineRule=“auto”/>
<w:jc w:val=“both”/>
<w:rFonts w:ascii=“Arial” w:eastAsia=“Times New Roman” w:hAnsi=“Arial” w:cs=“Times New Roman”/>
<w:szCs w:val=“24”/>
<w:lang w:val=“fr-CA” w:eastAsia=“fr-CA”/>


Thanks for your inquiry. The FieldOptions class represents options to control field handling in a document. Please use FieldOptions.FieldUpdateCultureSource property as shown below to get the desired output.

You may use one of following code example to get the desired output.

Document doc = new Document(MyDir + "Sample for Aspose - DATE, TIME fields culter.docx");

doc.FieldOptions.FieldUpdateCultureSource = FieldUpdateCultureSource.FieldCode;
doc.Save(MyDir + "output.pdf");

Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("fr-CA");
Document doc = new Document(MyDir + "Sample for Aspose - DATE, TIME fields culter.docx");
doc.Save(MyDir + "output.pdf");

Thanks for a quick reply.

Checked your code sample. Works like a charm.

BTW, do you have (or plan to have) RSS for forum threads? On the new forum I cannot find RSS link.


Thanks for your inquiry. We have logged this feature as DISCOURSE-249 in our issue tracking system. We will inform you via this forum thread once this feature is available. We apologize for your inconvenience.