Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Generate Reports from Excel Data in Java
You can present Microsoft Excel data in the form of customized reports to your users such as clients, stakeholders, etc. As a Java developer, you can generate such reports programmatically by using Excel spreadsheets as a table of data. Here, you will learn how to generate reports from Excel data using Java.
String srcDocument = "C:\\Files\\template.docx";
String docReport = "C:\\Files\\Output.docx";
String dataFilePath = "C:\\Files\\Contracts_Data.xlsx";
// Set extracting of column names from the first row.
DocumentTableOptions options = new DocumentTableOptions();
// Create document table
DocumentTable table = new DocumentTable(dataFilePath, 0, options);
// Create document assembler
DocumentAssembler assembler = new DocumentAssembler();
// Assemble data and generate report
new DataSourceInfo(new DataStorage(), null),
new DataSourceInfo(table,"ds"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment