Unable to use Italian language for CardText function

Hello

I have word document written in Italian with some fields using a CardText function.
I use Aspose to replace field and export document to PDF.
Because document is in Italian, I want CardText to print some numbers in Italian but it prints in English.
I changed my code to add language supporting, but when I set French, German, Spanish, CardText convert the numbers in the correct language. But when I set language as Italian or some others languages, the result of numbers is in English.

Have I miss something? Do we have something to configure to make aspose supporting Italian or other non-supporting language?

This is my code below. I need help please.


var templateInputStream = getClass().getResourceAsStream("/templates/input.docx");
LoadOptions loadOptions = new LoadOptions();
loadOptions.getLanguagePreferences().addEditingLanguage(EditingLanguage.ITALIAN_ITALY);
loadOptions.getLanguagePreferences().setDefaultEditingLanguage(EditingLanguage.ITALIAN_ITALY);
final var template = new Document(templateInputStream, loadOptions);

template.getFieldOptions().setFieldUpdateCultureSource(FieldUpdateCultureSource.FIELD_CODE);

for (Field field : template.getRange().getFields())
{
    System.out.println(field.getFieldCode() + " " + field.getType() + " " + field.getLocaleId());
    field.setLocaleId(EditingLanguage.ITALIAN_ITALY);
}

template.save("output.pdf", SaveFormat.PDF);

@difson Could you please attach your problematic document here for testing? We will check the issue and provide you more information.

input.docx (29.7 KB)
output.pdf (14.0 KB)
output_spanish.pdf (14.2 KB)

Hello,
Thanks for reply, this is documents.
We have :

  • A word document, witch is the document containing CardText field.
  • A pdf named output.pdf is the document i obtain when languages is set to Italian
  • A pdf named output_spanish.pdf, which is the one i obtain when the language is set to Spanish (Generation is correct here).

The data below is used for that generation.
NB: may be when you will open the word document, you will not see “bondAmountInteger” with cardtext, but the field is present. if you use the data below to generate, you should see the result as in my PDF files attached.

Thank you.

"fields": [
    {
      "fieldName": "bondAmount",
      "fieldValue": 15500.00
    },
    {
      "fieldName": "bondAmountInteger",
      "fieldValue": 344
    },
    {
      "fieldName": "bondAmountDecimal",
      "fieldValue": "00"
    }
  ]

@difson I was managed to reproduce your issue on my side. I have logged it as WORDSNET-24145 in our defect tracking system. We will keep you informed and let you know once it is resolved.

The issues you have found earlier (filed as WORDSNET-24145) have been fixed in this Aspose.Words for Java 22.9 update also available on Maven.