Hi,
I’m trying to create a word document replacing placeholder using LINQ Reporting Engine with JsonDataSource.
I’ve a problem with json number type (double). If I’ve a json property with value equal to 80.00 for example, the replacing result is -2147483648 (the minor number represented with 32 bit).
I tried with other number values with decimal difference from 0 (ex: 80.03) and the replacing result is correct.
Seems like the json number with all decimals to 0 is the problem.
How can Aspose replace correctly even json number with all 0 decimals value? For me a json value 80.0 differs from 80 because the type is different.
Here an example of Java code and document used:
String json = “{\n” +
““root”:\n” +
“{\n” +
““anagraficaObject”:\n” +
“{\n” +
““header”:{\n” +
““amount_percent” : 80.00,\n” +
““amount_double” : 456.123,\n” +
““amount_integer” : 123\n” +
“}\n” +
“}\n” +
“}\n” +
“}”;
FileInputStream input = new FileInputStream(ResourceUtils.getFile("classpath:TestDouble.docx"));
Document doc = new Document(input);
InputStream jsonIS = new ByteArrayInputStream(json.getBytes());
JsonDataSource ds = new JsonDataSource(jsonIS);
//ASPOSE report engine. Replace placeholders
ReportingEngine engine = new ReportingEngine();
//accepting missing attributes
engine.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS);
engine.buildReport(doc, ds, "root");
doc.save("prova.docx", SaveFormat.DOCX);
TestDouble.pdf (40.8 KB)