public void performExport(DataExportModel model, DataExportInstructions instructions, ConnectionHandler connectionHandler) throws DataExportException {
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet(model.getTableName());
if (instructions.createHeader()) {
HSSFRow headerRow = sheet.createRow(0);
for (int columnIndex = 0; columnIndex < model.getColumnCount(); columnIndex++){
String columnName = model.getColumnName(columnIndex);
HSSFCell cell = headerRow.createCell(columnIndex);
cell.setCellValue(columnName);
HSSFCellStyle cellStyle = workbook.createCellStyle();
HSSFFont tableHeadingFont = workbook.createFont();
tableHeadingFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
cellStyle.setFont(tableHeadingFont);
cell.setCellStyle(cellStyle);
}
}
CellStyleCache cellStyleCache = new CellStyleCache(workbook, model.getProject());
for (short rowIndex = 0; rowIndex < model.getRowCount(); rowIndex++) {
HSSFRow row = sheet.createRow(rowIndex + 1);
for (int columnIndex = 0; columnIndex < model.getColumnCount(); columnIndex++){
HSSFCell cell = row.createCell(columnIndex);
Object value = model.getValue(rowIndex, columnIndex);
if (value != null) {
if (value instanceof Number) {
Number number = (Number) value;
double doubleValue = number.doubleValue();