apache poi - XSSF 读取格式化的单元格值 [英] apache poi - XSSF read formatted cell value

查看:47
本文介绍了apache poi - XSSF 读取格式化的单元格值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以让我获得 excel 连续显示的格式化值,而不是我从流中返回的原始值?

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?

推荐答案

如果您有要从中获取数据的 Cell,请尝试以下操作

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);

如果这不能完全满足您的要求,DataFormatter 类中有许多不同的方法可以解决问题.查看API.

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.

这篇关于apache poi - XSSF 读取格式化的单元格值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆