poi 导出Excel时,百分比单元设置:

poi 导出Excel时,百分比 单元格设置:
HSSFCell cell = null;
HSSFCellStyle cellStyle = workbook.createCellStyle();

HSSFDataFHSSFCelormat dataFormat = workbook.createDataFormat();
cellStyle.setDataFormat(dataFormat.getFormat("0%"));
cell = row.createCell((short) 1);
cell.setCellStyle(cellStyle);
cell.setCellValue(terHistoryOnlineReport.getSuccessRate() == null ? 0 : 0.85);

你可能感兴趣的:(J2EE)