apache poi - XSSF read formatted cell value

2019-06-27 04:27发布

Is there any way I can get to the formatted value that excel shows in a row, versus the raw value I am getting returned from the stream?

Or would this fall under the "formula evaluation" category, which this does not support?

1条回答
贼婆χ
2楼-- · 2019-06-27 05:10

If you have the Cell that you're trying to get the data out of, try the following

DataFormatter formatter = new DataFormatter();
String formattedCellValue = formatter.formatCellValue(myCell);

If that doesn't get exactly what you're looking for, there are a number of different methods in the DataFormatter class that do the trick. Check out the API.

查看更多
登录 后发表回答