Apache OFBiz 中的 Apache POI 异常
我在一个项目中工作。它的服务器端应用程序在 ofbiz 中。我想阅读、编辑、更新等 excel 工作表。但是在正常的 java 程序中它可以工作。我使用 apache poi API。但是当放入 ofbiz 中时,然后运行有时会出现一些异常。以下是
"
[java] java.lang.IllegalStateException: Cannot get a text value from a nume
ric formula cell
[java] at org.apache.poi.hssf.usermodel.HSSFCell.typeMismatch(HSSFCell.
java:637)
[java] at org.apache.poi.hssf.usermodel.HSSFCell.checkFormulaCachedValu
eType(HSSFCell.java:642)
[java] at org.apache.poi.hssf.usermodel.HSSFCell.getRichStringCellValue
(HSSFCell.java:719)
[java]
[java] at org.apache.poi.hssf.usermodel.HSSFCell.getStringCellValue(HSS
FCell.java:697)
[java] at org.ofbiz.productionmgntSystem.setTargetPlan.getRequiredData(
setTargetPlan.java:764)
[java] *****
[java] at org.ofbiz.productionmgntSystem.setTargetPlan.setTask(setTarge
tPlan.java:201)
[java] at org.ofbiz.productionmgntSystem.ThreadProcess.run(ThreadProces
s.java:113)
"
我在普通 java 和 java 中使用相同的 apache poi API 的情况。商务部。
Im working in a project.Its server side application is in ofbiz.I want to read,edit,update,etc the excel sheet.But in normal java program its working.Im using apache poi API.But when put in ofbiz then run the application.Then sometimes some exception .The following are
"
[java] java.lang.IllegalStateException: Cannot get a text value from a nume
ric formula cell
[java] at org.apache.poi.hssf.usermodel.HSSFCell.typeMismatch(HSSFCell.
java:637)
[java] at org.apache.poi.hssf.usermodel.HSSFCell.checkFormulaCachedValu
eType(HSSFCell.java:642)
[java] at org.apache.poi.hssf.usermodel.HSSFCell.getRichStringCellValue
(HSSFCell.java:719)
[java]
[java] at org.apache.poi.hssf.usermodel.HSSFCell.getStringCellValue(HSS
FCell.java:697)
[java] at org.ofbiz.productionmgntSystem.setTargetPlan.getRequiredData(
setTargetPlan.java:764)
[java] *****
[java] at org.ofbiz.productionmgntSystem.setTargetPlan.setTask(setTarge
tPlan.java:201)
[java] at org.ofbiz.productionmgntSystem.ThreadProcess.run(ThreadProces
s.java:113)
"
Here im using same apache poi API in both normal java & ofbiz.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当读取整数交易编号时,我遇到了同样的问题。我想到解决这个问题的自然方法是使用:
这不起作用,因为 12345 被转换为 12345.0
获取与 excel 文档中显示的字符串值完全相同的解决方法是:
I had this same problem when integer transaction numbers were being read. The natural way that occurred to me to fix this was to use:
This doesn't work as 12345 is converted to 12345.0
The workaround to get the string value exactly as it appears in the excel document is to do:
Excel 通常会将仅包含数字的单元格存储为数字单元格,而不是字符串单元格。您可能认为它不是数字单元格,但它是...
您可能想要类似的内容:
查看 POI 快速指南和操作方法帮助您开始使用 POI。
Excel will often store cells containing only numbers as numeric cells, rather than string cells. You may think it isn't a numeric cell, but it is...
You probably want something like:
Have a look at the POI quick guide and howto to get you started with using POI.