Skip to content

Instantly share code, notes, and snippets.

@ssaurel
Created February 26, 2018 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssaurel/cacc4d658963156352887c9590b4028f to your computer and use it in GitHub Desktop.
Save ssaurel/cacc4d658963156352887c9590b4028f to your computer and use it in GitHub Desktop.
Create Rows for the Excel tutorial on the SSaurel's Channel
// Create Other rows and cells with contacts data
int rowNum = 1;
for (Contact contact : contacts) {
Row row = sheet.createRow(rowNum++);
row.createCell(0).setCellValue(contact.firstName);
row.createCell(1).setCellValue(contact.lastName);
row.createCell(2).setCellValue(contact.email);
row.createCell(3).setCellValue(contact.dateOfBirth);
}
// Resize all columns to fit the content size
for (int i = 0; i < columns.length; i++) {
sheet.autoSizeColumn(i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment