更新时间:2023-02-18 15:57:56
您需要:
是这样的:
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.