Number formatting in Italian documents

We are creating documents for UK English and Italian languages.

I am encountering a problem with formatting numbers for Italian.

To take an example, I have the number 801.54, which needs to be displayed in a table of figures. The Italians use commas for decimals, and decimals for commas, so this number needs to look like 801,54 Typically, these numbers need to be displayed to two decimal places. When using formatting codes in mergefields, I get the following results:

MERGEFIELD FirstInstalment gives 801,5400

MERGEFIELD FirstInstalment # #.###,## gives 80154

MERGEFIELD FirstInstalment # #,###.## gives 80.154

I am attaching the it-IT locale to the current thread and this is dealing with date formats nicely, but I’m wondering what is going on with these numbers. Worst case, we tell the customer they have to have four decimal places, but it would nice to get it spot on.

Hi
Thanks for your request. At the moment Aspose.Words requires picture format switches in merge fields to be in the US (InvariantCulture) format. Please see the following thread for more information.
https://forum.aspose.com/c/words/8
Best regards.

Further investigation has shown that I need to reset the thread locale back to English once the mailmerge is done, otherwise subsequent database operations bring back Italian formatted numbers which other parts of the code (notably database code processing XML) get confused. So we can put that down to a bug in my code!

Hi
It is very good that you already found solution.
Best regards.