How to export comma separated values to separate paragraph using Java | LINQ Reporting

Hi Team,

Please share the sample code structure to implement the below features using LINQ reporting engine in aspose.word for JAVA along with JSON Data

  • Inserting “N” number of documents dynamically into Main Document while building the engine during runtime.
  • Number formatting Syntax: - Input amount : 123456.0000 Expected Output Amount : 123,456.00 (millions comma separator with two decimal places).in Tag format
  • String formatting Syntax:- Splitting / replacing the string while executing the tag

Thanks in Advance,

Shyamala B


Please ZIP and attach JSON data along with input documents and expected output document. We will then provide you more information about your query along with code example.

Hi Tahir,

I wrote my queries into “Queries_String_Number_Formatting_Output.docx” file inside this Zip Folder.

Please share the sample code with template tag syntax which helps to upgrade my work in aspose.word for java (64.6 KB)

Thanks in Advance
Shyamala B


Thanks for sharing the detail. We are checking your use cases and will share the code example along with template syntax as soon as possible.


We suggest you please read the following articles.
Template Syntax
Appendix A. Enumeration Extension Methods
LINQ Reporting Engine API

Please use the following template syntax to format the number.

Payment: <<[payment]: "##,####.00">>

Unfortunately, Aspose.Words does not support this feature. We have logged it as WORDSNET-20654 in our issue tracking system. You will be notified via this forum thread once this feature is available. We apologize for your inconvenience.

Please use the following template syntax to sort the data by year, and display the name with comma separated values.

Name: <<[name]>>, Age: <<[age]>>, full address: <<[fulladdress] >>

Payment: <<[payment]: "##,####.00">>

<<foreach [in gear.Where(g => g.year == “1983”)]>><<[name]>>,<</foreach>>

<<foreach [in gear.OrderBy(g => g.year)]>>

Name : <<[name]>>

Year : <<[year]>>


Following code example shows how to use the JSON data source with above template.

Document doc = new Document(MyDir + "templateJson.docx");

var json = File.ReadAllText(MyDir + "JSON_Data.json");

JsonDataLoadOptions options = new JsonDataLoadOptions();
options.SimpleValueParseMode = JsonSimpleValueParseMode.Strict;

var dataStream = new MemoryStream(Encoding.ASCII.GetBytes(json));
var jsonDataSource = new JsonDataSource(dataStream, options);

var engine = new ReportingEngine();
engine.BuildReport(doc, jsonDataSource);

doc.Save(MyDir + "20.6.docx");

Please use following template and code example to insert documents dynamically.

<<foreach [item in items]>>
 <<doc [item] -build>>

Document doc = new Document(MyDir + "input.docx");
ReportingEngine engine = new ReportingEngine();
List<string> docs = new List<string> { MyDir + "FirstDocument.docx", MyDir + "SecondDocument.docx", MyDir + "ThirdDocument.docx" };
engine.BuildReport(doc, docs, "items");
doc.Save(MyDir + "20.6.docx");


We have closed the issue WORDSNET-20654. You export the comma separated value in paragraphs using following template and code example.

 <<foreach [item in Arrays.asList(person.fulladdress.split(“,”))]>>

Document document = new Document("template.docx");
ReportingEngine engine = new ReportingEngine();

engine.setOptions(ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS); // This is needed to remove extra empty paragraphs.
engine.getKnownTypes().add(java.util.Arrays.class); // This is needed to use static members of the Arrays class in the template.

engine.buildReport(document, new JsonDataSource("JSON_Data.json"), "person");"out.docx");

Hi Tahir,

Thanks for your great help !!

I got the expected response to update the template merge using reporting engine.

I will reach you if i need any help again.

Thanks & Regards,
Shyamala B

Hi Team,

Another issue in JSON Data source to merge with template using reporting engine.
In listing of JSON Array Object, if any one of the object is null, reporting engine is skipping to render the details for all json array object which holds the data into the generated template.

Please refer the attached Zip package for sample input and expected (23.3 KB)
put details


Please use ReportingEngine.Options as shown below to get the desired output. Hope this helps you.

Document document = new Document(MyDir + "sampletemplate.docx");
ReportingEngine engine = new ReportingEngine();

engine.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS); // This is needed to remove extra empty paragraphs.

engine.buildReport(document, new JsonDataSource(MyDir + "managers.json"), "managers"); + "out.docx");

Thanks Tahir!!

Already i added this “allow-missing-members” into engine builder option while building the report.

But, Still facing the same issue as Engine doesn’t support to render all managers contract details into generated output document if any one of the managers contract details as null.

Please refer the sample managers.json file( which contain one of the contracts array object as null) along with Sampleoutput document as we have shared already.

Thanks & Regards,
Shyamala B


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-20711 . You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Thanks Team !!

I hope, Logged issue will resolve as much earlier which helps us to upgrade the template merge options from Mail Merge to LINQ Reporting engine.

Shyamala B


We will inform you via this forum thread once there is an update available on it. Thanks for your patience and understanding.

The issues you have found earlier have been fixed in this Aspose.Words for .NET 20.12 update and this Aspose.Words for Java 20.12 update.