优化Excel统计行数值的单元格样式显示
This commit is contained in:
parent
1a2f20e859
commit
7b9060af26
@ -186,11 +186,6 @@ public class ExcelUtil<T>
|
||||
*/
|
||||
private Map<Integer, Double> statistics = new HashMap<Integer, Double>();
|
||||
|
||||
/**
|
||||
* 数字格式
|
||||
*/
|
||||
private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("######0.00");
|
||||
|
||||
/**
|
||||
* 实体对象
|
||||
*/
|
||||
@ -861,6 +856,7 @@ public class ExcelUtil<T>
|
||||
style = wb.createCellStyle();
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
style.setDataFormat(dataFormat.getFormat("######0.00"));
|
||||
Font totalFont = wb.createFont();
|
||||
totalFont.setFontName("Arial");
|
||||
totalFont.setFontHeightInPoints((short) 10);
|
||||
@ -1442,7 +1438,7 @@ public class ExcelUtil<T>
|
||||
{
|
||||
cell = row.createCell(key);
|
||||
cell.setCellStyle(styles.get("total"));
|
||||
cell.setCellValue(DOUBLE_FORMAT.format(statistics.get(key)));
|
||||
cell.setCellValue(statistics.get(key));
|
||||
}
|
||||
statistics.clear();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user