Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu Jul 02, 2020 9:59 am

Hi, I have trouble with the next code:
Code: Select all
public static void main(String[] args) {
    var doc = new Document();
    doc.setQuiteMode(true);
    doc.loadFromFile("path_to_template");
    doc.replace("#invoiceID", "123", true, true);
    doc.isUpdateFields(true);
    doc.saveToFile("invoice.pdf", PDF);
}

As a result, I have:
Code: Select all
Exception in thread "main" class com.spire.doc.packages.sprTtB: Culture Name: en-UA is not a supported culture

I was able to figure out what the problem is in the language or culture of the file, there is an API in C#, but unfortunately, I didn't find how to set it from the Java API.

Thanks a lot!

maystrovyy
 
Posts: 1
Joined: Thu Jul 02, 2020 9:51 am

Fri Jul 03, 2020 8:19 am

Hi,

Thanks for your inquiry.
Do you mean that you want to set the language or culture area through the code? If so, please refer to the below code.
Code: Select all
Locale.setDefault(Locale.UK);
Locale.setDefault(Locale.Category.FORMAT, Locale.forLanguageTag("en-UA"));

If your issue still exists after trying, to help further look into it, please share us with the following more information. Thanks in advance.
1. Your input word file, you could attach them here or send them to us(support@e-iceblue.com) via email.
2. Your testing environment information, such as your system information (E.g. Win7, 64 bit) and region setting (E.g.Ukraine, Ukrainian).

Sincerely,
Gina
E-iceblue support team
User avatar

Gina.li
 
Posts: 4
Joined: Wed Jul 01, 2020 1:46 am

Return to Spire.Doc