Gal*_*ezu 0 java apache excel apache-poi
使用Apache POI生成文档,我对单元格样式有一个小问题,currentlly我正在使用:
CellStyle currencyCellStyle=workbook.createCellStyle();
currencyCellStyle.setDataFormat(format.getFormat("$#,##0.00"));
Run Code Online (Sandbox Code Playgroud)
这对于正数而言完全正常,但是我想自动为负数单元分配不同的样式.
问题是有没有设置它而不必检查单个单元格值并为它们分配单独的样式?
或者有没有办法告诉Apache POI使用内置的Excel货币格式和其中一个否定选项?
发现它,谢谢我:D
CellStyle currencyCellStyle=workbook.createCellStyle();
currencyCellStyle.setDataFormat(format.getFormat("$#,##0.00;[Red]($#,##0.00)"));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3939 次 |
| 最近记录: |