Created
February 26, 2018 14:04
-
-
Save ssaurel/cacc4d658963156352887c9590b4028f to your computer and use it in GitHub Desktop.
Create Rows for the Excel tutorial on the SSaurel's Channel
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 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