We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to control the render language of word fields in DOCX when converting to pdf


I am converting a Word document to pdf. the Document contains several word fields for example:

I want to display current date. so I use msword field like:  {DATE \@ "dddd, MMMM d, yyyy"} , this will render as full date.

However looks like all the fields are always displayed as English (so the day name will be english like 'Sunday') instead of the language of the rest of the document (e.g. French, German ...)

Is there a way to control the language ?

 Thank you

3 Replies

SB Suriya Balamurugan Syncfusion Team December 15, 2022 04:30 PM UTC

From the given details, we have found that your requirement is to render the date and time in language (e.g. French, German,..) while converting Word document to PDF.

While performing Word to PDF conversion,
Essential DocIO library renders the data and time as per the culture used in your end.

We suggest you to set the French culture (fr-CA) to display the date and time in French language or German culture (de-DE) to display the date and time in German language as per your requirement.

Please refer the below highlighted code snippet to know the current culture used in your end,

CultureInfo currentCulture = CultureInfo.CurrentCulture;

Please refer the below highlighted code snippets to set the culture in your end,

CultureInfo culture = new CultureInfo("fr-CA");

CultureInfo.DefaultThreadCurrentCulture = culture;

CultureInfo.DefaultThreadCurrentUICulture = culture;


FileStream fileStream = new FileStream(@"Test-doc-french.docx", FileMode.Open, FileAccess.ReadWrite);

//Loads the input document.

WordDocument document = new WordDocument(fileStream, FormatType.Docx);

//Convert Word document to PDF code snippet.

Note: If this post is helpful, please consider accepting it as the solution so that other members can locate it more quickly.

AP appa December 16, 2022 07:37 PM UTC

Thank you,

Is it possible to set the language without changing the Default thread culture ?

As my website code needs to generate documents in many languages, thus setting the default thread may cause issues when several threads try to create PDF with different languages 

SB Suriya Balamurugan Syncfusion Team December 19, 2022 06:51 PM UTC

On further analyzing while converting Word document to PDF in Microsoft Word application, there is no option to set the language to display the date and time for the date field in the Word document. So, it is necessary to set the culture in order to preserve the date and time field in a specific language while converting Word document to PDF using DocIO library.

To resolve the problem facing in changing the default thread culture, we suggest you to pass the culture name which you want to preserve as a parameter to the method (changed to the specific culture and convert Word document to PDF) and then reset the culture back to the default culture after PDF conversion. So, the default culture is back now, which will not affect the other document conversion. If you need, again set and reset culture for specific document conversion.

We have prepared the sample application to change the specific culture back to default culture after PDF conversion and it can be downloaded from the below attachment.

Attachment: ConsoleNETCoreSample_f576b8.zip

Live Chat Icon For mobile
Up arrow icon