Apache poi - 千位分隔符 [英] Apache poi - Thousand separator

查看:50
本文介绍了Apache poi - 千位分隔符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你知道我如何设置千位分隔符并有一个这样格式的值吗?403.000

Do you know how can I set the thousand sepator and have a value formatted like this? 403.000

我在 Java 中使用 apache-poi 3.8.我用谷歌搜索了很多,但我没有找到答案.我不能使用字符串值,因为我的公式没有以这种方式正确计算.有什么帮助吗?谢谢!

I'm using apache-poi 3.8 with Java. I googled it a lot but I didn't find an answer. I can't use a string value because my formulas are not evaluated correctly in this way. Any help? thanks!

我尝试过这样的事情:

cellStyle.setDataFormat(creationHelper.createDataFormat().getFormat("#.##0")); 

但它不起作用..

推荐答案

为其他可能有同样问题的人回答我自己的问题.

Answering my own question for everyone else who might have the same issue.

找到了:格式必须是:"#,##0"

dataCell.getCellStyle().setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0"));

这篇关于Apache poi - 千位分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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