Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
LINQ Reporting Engine - Aspose.Words for Java
// Create Document object and initialize with DOCX template.
Document doc = new Document("template.docx");
// Load CSV
CsvDataSource dataSource = new CsvDataSource("datasource.csv");
// Create ReportingEngine object.
ReportingEngine engine = new ReportingEngine();
// Build report.
engine.buildReport(doc, dataSource, "persons");
// Save as Word document.
doc.save("word.docx");
// Create Document object and initialize with DOCX template.
Document doc = new Document("template.docx");
// Create Sender object.
Sender sender = new Sender("LINQ Reporting Engine", "Hello World");
// Create ReportingEngine object.
ReportingEngine engine = new ReportingEngine();
// Build report.
engine.buildReport(doc, sender, "s");
// Save as Word document.
doc.save("word.docx");
// Create Document object and initialize with DOCX template.
Document doc = new Document("template.docx");
// Load JSON
JsonDataSource dataSource = new JsonDataSource("datasource.json");
// Create ReportingEngine object.
ReportingEngine engine = new ReportingEngine();
// Build report.
engine.buildReport(doc, dataSource, "managers");
// Save as Word document.
doc.save("word.docx");
// Create Document object and initialize with DOCX template.
Document doc = new Document("template.docx");
// Load XML
XmlDataSource dataSource = new XmlDataSource("./datasource.xml");
// Create ReportingEngine object.
ReportingEngine engine = new ReportingEngine();
// Build report.
engine.buildReport(doc, dataSource, "persons");
// Save as Word document.
doc.save("word.docx");
John Doe 30 1989-04-01 4:00:00 pm
Jane Doe 27 1992-01-31 07:00:00 am
John Smith 51 1968-03-08 1:00:00 pm
[
{
Name: "John Smith",
Contract:
[
{
Client:
{
Name: "A Company"
},
Price: 1200000
},
{
Client:
{
Name: "B Ltd."
},
Price: 750000
},
{
Client:
{
Name: "C & D"
},
Price: 350000
}
]
},
{
Name: "Tony Anderson",
Contract:
[
{
Client:
{
Name: "E Corp."
},
Price: 650000
},
{
Client:
{
Name: "F & Partners"
},
Price: 550000
}
]
},
]
<Persons>
<Person>
<Name>John Doe</Name>
<Age>30</Age>
<Birth>1989-04-01 4:00:00 pm</Birth>
</Person>
<Person>
<Name>Jane Doe</Name>
<Age>27</Age>
<Birth>1992-01-31 07:00:00 am</Birth>
</Person>
<Person>
<Name>John Smith</Name>
<Age>51</Age>
<Birth>1968-03-08 1:00:00 pm</Birth>
</Person>
</Persons>
public class Sender {
public Sender(String name, String message) {
_name = name;
_message = message;
}
public String getName() {
return _name;
}
public String getMessage() {
return _message;
}
private String _name;
private String _message;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.