Aspose.Words for Java version 23.1 ignores locale

Hello,
I tried to upgrade aspose.words from version 21.4 to version 23.1. I want to generate german documents on an english laguage system by setting the locale to german.
In version 21.4 this worked but in version 23.1 I get wrong numbers in my document.
The Java code:

import com.aspose.words.Document;
import com.aspose.words.net.System.Data.DataSet;
import java.util.Locale;
public class TestApp {
    public static void main(String[] args) throws Exception {
        Locale.setDefault(Locale.GERMANY);
        DataSet dataSet = new DataSet();
        dataSet.readXml("C:\\temp\\data\\data.xml");
        Document doc = new Document("C:\\temp\\data\\template.docx");
    	doc.getMailMerge().executeWithRegions(dataSet);
    	doc.save("C:\\temp\\data\\20230126_v23_1.pdf");
    }
}

The data:

<root>
    <value1>20.01</value1>
    <value2>20.0001</value2>
</root>

When I execute this with version 21.4 I get (this is correct):
20,01
20,00
and with version 23.1:
2001,00
200001,00

Best,
Peter Binnigexample.zip (78.2 KB)

@p.binnig Please try using the following code:

// Set locale for the current thread.
Locale current = CurrentThreadSettings.getLocale();
CurrentThreadSettings.setLocale(Locale.GERMANY);

// Execute your code here.
// .....

// Restore locale.
CurrentThreadSettings.setLocale(current);

If the problem still persist, please attach your template and output documents here for testing. We will check the documents and provide you more information.

Hello,
I tried all combinations with

CurrentThreadSettings.setLocale(Locale.GERMANY);

and

Locale.setDefault(Locale.GERMANY);

both, neither.
All with the same result.
Best,
Peter Binnigexample2.zip (78.3 KB)

@p.binnig Could you please attach your template.docx document here for testing or let us know what format switches are used in the merge fields in your template.

Sorry something went wrong when I packt my previous upload.
data.zip (87.7 KB)

@p.binnig Thank you for additional information. Behavior of the current version of correct. When you use read your XML file into DataSet using this code:

DataSet dataSet = new DataSet();
dataSet.readXml("C:\\Temp\\data.xml");

Columns data type is considered as String. Then when you execute mail merge the string value is parsed to double, but since German culture has period as a group separator, the string "20.01" is considered as 2001 double value and string "20.0001" as 200001 double. To get the expected result you should explicitly specify type of the columns in your data source. In case of XML, you can use XSD schema like this to define columns data type:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="root">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="value1" type="xs:double" />
				<xs:element name="value2" type="xs:double" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>

And use the following code:

// Set locale for the current thread.
Locale current = CurrentThreadSettings.getLocale();
CurrentThreadSettings.setLocale(Locale.GERMANY);

DataSet dataSet = new DataSet();
dataSet.readXmlSchema("C:\\Temp\\schema.xsd");
dataSet.readXml("C:\\Temp\\data.xml");
Document doc = new Document("C:\\Temp\\template.docx");
doc.getMailMerge().executeWithRegions(dataSet);
doc.save("C:\\temp\\out.pdf");

// Restore locale.
CurrentThreadSettings.setLocale(current);

out.pdf (14.1 KB)