Free Support Forum - aspose.com

LINQ Reporting with JsonDataSource generates incorrect output for number type double using Java

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)

@Liscor

Could you please attach your input Word document here for testing? We will investigate the issue on our side and provide you more information.

Hi,
Isn’t possible to attach the “.docx" files, I convert this in ".pdf” and attach in topic (TestDouble.pdf).
Now attach the output file.
Regards.

output_document.pdf (92.2 KB)

@Liscor

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-19807. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi,
Why “WORDSNET”? Our certificate is for Java.
Regards.

@Liscor

Please note that the latest version of Aspose.Words for Java is completely auto-ported from .NET, i.e. we do not write code for Aspose.Words for Java; it is generated out automatically from C# code of Aspose.Words for .NET. In your case, the issue which was logged with WORDSNET prefix, would be auto resolved for Java variant of Aspose.Words. Your problem WORDSNET-19807 will be fixed in Aspose.Words for Java as soon as the linked issue is resolved.

A post was split to a new topic: Update of WORDSNET-19807

@Liscor

It is to inform you that this issue (WORDSNET-19807) has been resolved. Please use the latest version of Aspose.Words for Java 20.3 and let us know if you have any more queries.