SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm");
if ((objects != null) && !(objects.isEmpty())) {
int lineNumber = 0;
for (Object o : objects) {
Program program = (Program) o;
// index from 0,0... cell A1 is cell(0,0)
HSSFRow row1 = worksheet.createRow(lineNumber);
HSSFCell cellA1 = row1.createCell(0);
cellA1.setCellValue(getResourceBundle().getString("PROGRAM_NAME"));
HSSFCellStyle cellStyle = workbook.createCellStyle();
cellStyle.setFillForegroundColor(HSSFColor.LIGHT_GREEN.index);
cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
cellA1.setCellStyle(cellStyle);
HSSFCell cellB1 = row1.createCell(1);
cellB1.setCellValue(getResourceBundle().getString("PROGRAM_LAUNCH_DATE"));
cellStyle = workbook.createCellStyle();
cellStyle.setFillForegroundColor(HSSFColor.LIGHT_BLUE.index);
cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
cellB1.setCellStyle(cellStyle);
HSSFRow row2 = worksheet.createRow(++lineNumber);
HSSFCell cellA2 = row2.createCell(0);
cellA2.setCellValue(program.getName());
HSSFCell cellB2 = row2.createCell(1);
cellStyle = workbook.createCellStyle();
cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("dd/MM/yyyy HH:mm"));
cellB2.setCellValue(sdf.format(program.getLaunchDate()));
cellB2.setCellStyle(cellStyle);
lineNumber = lineNumber + 2;
}
}