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

Free Support Forum - aspose.com

Excel to PDF-Changing locale settings for English/German language using Aspose.Cells for Java

In my application, I’m exporting Workbooks as PDFs in either English or German. This means that date formats and decimal separators are different per language. It seems like the work environment’s language is set as the default language. Unfortunately, I cannot seem to change it at all.

My understanding is that using the following code would change every “1.234.567,89” into “1,234,567.89” and every “Dezember” into “December”:

	WorkbookSettings settings = workbook.getSettings();
	settings.setLanguageCode(CountryCode.USA);
	settings.setLocale(Locale.US);
	settings.setRegion(CountryCode.USA);

But the exported PDF stays completely German. I’d rather not change the entire work environment’s language if I can help it.

I’m using Aspose.Cells 19.9.

Okay, I think I’ve discovered the cause myself. I’m saving the file as XLSX first before converting it into PDF. Along the way, the locale settings get lost, probably because they are indeed system-dependent instead of dedicated to the workbook.

In other words, there’s probably nothing I can do other than hacking my way out.

@Selbi,

Thanks for the details.

Generally locale settings are system dependent. Anyways, could you provide your template files (input, output file, etc.), paste complete sample code (runnable) and some screenshots to highlight the issue, we will check it soon. If this is an issue with Aspose.Cells APIs, we will try to figure it (after we have logged the issue) out soon.

Thank you Amjad, but I’ve discovered that the problem was that I saved my workbook as XLSX first, then opened it again as Aspose Workbook in Java, and saved it again as PDF. In the process the localization settings indeed got lost.

The solution was simply to set the localization settings right before saving the PDF.

@Selbi,
It seems that your issue is resolved. Feel free to contact us at any time if you need further help or have some other issue or queries, we will be happy to assist you soon.