Created
January 14, 2020 09:02
-
-
Save aspose-com-gists/c30329ccddd339ce7f05c1e8cae06aa8 to your computer and use it in GitHub Desktop.
LINQ Reporting Engine - Aspose.Words for Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
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 | |
} | |
] | |
}, | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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