Instantly share code, notes, and snippets.

Embed
What would you like to do?
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