diff --git a/assignment/impl/src/java/org/sakaiproject/assignment/impl/SpreadsheetExporter.java b/assignment/impl/src/java/org/sakaiproject/assignment/impl/SpreadsheetExporter.java index 0d69e479d00a..c447e7f5cae2 100644 --- a/assignment/impl/src/java/org/sakaiproject/assignment/impl/SpreadsheetExporter.java +++ b/assignment/impl/src/java/org/sakaiproject/assignment/impl/SpreadsheetExporter.java @@ -19,6 +19,8 @@ import org.apache.poi.hssf.usermodel.*; import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellType; +import org.apache.poi.ss.usermodel.Font; import org.apache.poi.ss.usermodel.IndexedColors; import org.sakaiproject.util.Validator; @@ -133,7 +135,7 @@ private HSSFCellStyle createHeaderStyle(){ HSSFFont font = gradesWorkbook.createFont(); font.setFontName(HSSFFont.FONT_ARIAL); font.setColor(IndexedColors.PLUM.getIndex()); - font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + font.setBold(true); HSSFCellStyle cellStyle = gradesWorkbook.createCellStyle(); cellStyle.setFont(font); return cellStyle; @@ -156,7 +158,7 @@ public SpreadsheetExporter addRow(String... values) { HSSFRow dataRow = dataSheet.createRow(rowCount++); for (int i = 0; i < values.length; i++) { HSSFCell cell = dataRow.createCell(i); - cell.setCellType(Cell.CELL_TYPE_STRING); + cell.setCellType(CellType.STRING); cell.setCellValue(values[i]); } return this; diff --git a/jsf/jsf-spreadsheet/src/java/org/sakaiproject/jsf/spreadsheet/SpreadsheetDataFileWriterXls.java b/jsf/jsf-spreadsheet/src/java/org/sakaiproject/jsf/spreadsheet/SpreadsheetDataFileWriterXls.java index f181ad4399b4..ff45371168f8 100644 --- a/jsf/jsf-spreadsheet/src/java/org/sakaiproject/jsf/spreadsheet/SpreadsheetDataFileWriterXls.java +++ b/jsf/jsf-spreadsheet/src/java/org/sakaiproject/jsf/spreadsheet/SpreadsheetDataFileWriterXls.java @@ -29,17 +29,18 @@ import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.apache.poi.hssf.usermodel.HSSFCell; -import org.apache.poi.hssf.usermodel.HSSFCellStyle; -import org.apache.poi.hssf.usermodel.HSSFFont; -import org.apache.poi.hssf.usermodel.HSSFRow; -import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.util.HSSFColor; - +import org.apache.poi.ss.usermodel.BorderStyle; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; import org.sakaiproject.component.cover.ServerConfigurationService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -67,21 +68,20 @@ public void writeDataToResponse(List> spreadsheetData, String fileN } } - private HSSFWorkbook getAsWorkbook(List> spreadsheetData) { - HSSFWorkbook wb = new HSSFWorkbook(); - HSSFSheet sheet = wb.createSheet(); - HSSFCellStyle headerCs = wb.createCellStyle(); + private Workbook getAsWorkbook(List> spreadsheetData) { + Workbook wb = new HSSFWorkbook(); + Sheet sheet = wb.createSheet(); + CellStyle headerCs = wb.createCellStyle(); Iterator> dataIter = spreadsheetData.iterator(); // Set the header style - headerCs.setBorderBottom(HSSFCellStyle.BORDER_THIN); + headerCs.setBorderBottom(BorderStyle.THICK); headerCs.setFillBackgroundColor(HSSFColor.BLUE_GREY.index); - // Set the font - HSSFCellStyle cellStyle = null; + CellStyle cellStyle = null; String fontName = ServerConfigurationService.getString("spreadsheet.font"); if (fontName != null) { - HSSFFont font = wb.createFont(); + Font font = wb.createFont(); font.setFontName(fontName); headerCs.setFont(font); cellStyle = wb.createCellStyle(); @@ -89,10 +89,10 @@ private HSSFWorkbook getAsWorkbook(List> spreadsheetData) { } // By convention, the first list in the list contains column headers. - HSSFRow headerRow = sheet.createRow((short)0); + Row headerRow = sheet.createRow((short)0); List headerList = dataIter.next(); for (short i = 0; i < headerList.size(); i++) { - HSSFCell headerCell = createCell(headerRow, i); + Cell headerCell = createCell(headerRow, i); headerCell.setCellValue((String)headerList.get(i)); headerCell.setCellStyle(headerCs); sheet.autoSizeColumn(i); @@ -101,9 +101,9 @@ private HSSFWorkbook getAsWorkbook(List> spreadsheetData) { short rowPos = 1; while (dataIter.hasNext()) { List rowData = dataIter.next(); - HSSFRow row = sheet.createRow(rowPos++); + Row row = sheet.createRow(rowPos++); for (short i = 0; i < rowData.size(); i++) { - HSSFCell cell = createCell(row, i); + Cell cell = createCell(row, i); Object data = rowData.get(i); if (data != null) { if (data instanceof Double) { @@ -121,8 +121,8 @@ private HSSFWorkbook getAsWorkbook(List> spreadsheetData) { return wb; } - private HSSFCell createCell(HSSFRow row, short column) { - HSSFCell cell = row.createCell(Integer.valueOf(column).intValue()); + private Cell createCell(Row row, short column) { + Cell cell = row.createCell(Integer.valueOf(column).intValue()); return cell; } diff --git a/master/pom.xml b/master/pom.xml index c79986868d1f..104aecd882de 100644 --- a/master/pom.xml +++ b/master/pom.xml @@ -119,7 +119,7 @@ 2.6.2 1.2.17 1.7.21 - 3.16 + 3.17 2.7.22 1.7.0RC4 2.0 diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/ExportResponsesBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/ExportResponsesBean.java index e4818881c375..f346bd61980b 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/ExportResponsesBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/ExportResponsesBean.java @@ -357,7 +357,7 @@ public Workbook getAsWorkbook(List> spreadsheetData) { CellStyle boldStyle = wb.createCellStyle(); Font font = wb.createFont(); - font.setBoldweight(Font.BOLDWEIGHT_BOLD); + font.setBold(true); String fontName = ServerConfigurationService.getString("spreadsheet.font"); if (fontName != null) { font.setFontName(fontName); diff --git a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolBean.java b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolBean.java index a7ad765ecf12..e57436e0d2ab 100644 --- a/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolBean.java +++ b/samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolBean.java @@ -2536,7 +2536,7 @@ public Workbook getAsWorkbook(List> spreadsheetData) { CellStyle boldStyle = wb.createCellStyle(); Font font = wb.createFont(); - font.setBoldweight(Font.BOLDWEIGHT_BOLD); + font.setBold(true); boldStyle.setFont(font); CellStyle headerStyle = boldStyle;