Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create an Excel spreadsheet from Groovy (Java) using Apache POI 3.9
def export = {
// create a new file
FileOutputStream out = new FileOutputStream("workbook.xls");
// create a new workbook
Workbook wb = new HSSFWorkbook();
// create a new sheet
Sheet s = wb.createSheet();
int rownum = 0
for (ClaimDocumentReferenceDTO ref : docRefs) {
// create a row
Row r = s.createRow(rownum++)
for (int cellnum=0; cellnum <10; cellnum++) {
Cell c = r.createCell(cellnum);
c.setCellValue( "Test" );
}
}
wb.write(out);
out.close();
}
@wytten

This comment has been minimized.

Copy link
Owner Author

wytten commented Jun 28, 2013

I also found a good article titled "Turn your JAVA Beans into a POI Excel Spreadsheet" at http://www.dominotricks.com/?p=115

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.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.