Aspose.Words.Document.Save() as PDF changes date localization in document

Hi.
Could you please take a look on attached Word document, which contains Date field. PC has Danish localization, but UI language is English. So, when exporting Word document to PDF using Word, the date is exported with English localication (see attachement). However, when doing the same using :
Dim AsposeDocument As New Aspose.Words.Document(fileName)
AsposeDocument.Save(pdfPath, Aspose.Words.SaveFormat.Pdf)
the date is converted to Danish locale.

Can we somehow specify desired localization during export? Thank you!

RegionalSettings.png (9.9 KB)
CurrentSate_Aspose.pdf (19.6 KB)
Currentdate.pdf (35.3 KB)
Currentdate.docx (11.6 KB)

@Olexandr

The Document.FieldOptions property provides FieldOptions object that represents options to control field handling in the document. You can use FieldOptions.FieldUpdateCultureSource as shown below to get the desired output.

  • By default the FieldOptions.FieldUpdateCultureSource property is set to FieldUpdateCultureSource.CurrentThread which formats fields using the current thread culture.
  • This property can be set to FieldUpdateCultureSource.FieldCode so the language set from the field code of the field is used for formatting instead.
Document doc = new Document(MyDir + "Currentdate.docx");
doc.FieldOptions.FieldUpdateCultureSource = FieldUpdateCultureSource.FieldCode;            
doc.Save(MyDir + "21.5.pdf");

We suggest you please read the following article.