更新时间:2023-02-18 15:54:06
您需要:
类似于:
cell.setCellValue(0.123); // set value as number
CellStyle style = workbook.createCellStyle();
style.setDataFormat(workbook.createDataFormat().getFormat("0.000%"));
cell.setCellStyle(style);
查看 POI 快速指南的用户定义格式部分更多细节.您可能还想阅读示例,其中展示了如何使用不同的 POI 功能.
Take a look at user defined formats section of POI quick guide for more details. You may also want to go through the examples which show how to use different POI capabilities.