apache poi - XSSF read formatted cell value

拈花ヽ惹草 提交于 2020-01-02 04:05:10

问题


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:


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.



来源:https://stackoverflow.com/questions/18237828/apache-poi-xssf-read-formatted-cell-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!