同一个Apache POI(EXCEL)code演戏不同,具体取决于系统类型(32位,64位) [英] Same Apache poi (excel) code acting differently depending on system types (32bit, 64bit)

查看:216
本文介绍了同一个Apache POI(EXCEL)code演戏不同,具体取决于系统类型(32位,64位)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Apache POI 3.10成功生成了一个Excel文件,该程序只能运行在32位系统如预期。

I have successfully generated an excel file using apache poi 3.10, the program only runs as expected on 32bit systems.

但试图在64位系统上运行它的时候,大多数数据被排除细胞,他们根本不露面(但同样code可工作于32位系统就好了)。
我能做些什么,使所有产生的细胞数据可以在64位系统甚至显示?

BUT when tried to run it on 64bit systems, most of the cells data are left out, they simply don't show up (but the same code will work just fine on 32bit systems). what can I do so that all the generated cell data can show even on 64bit systems?

HSSFWorkbook my_xls_workbook = new HSSFWorkbook(input_document);
HSSFSheet my_worksheet = my_xls_workbook.getSheetAt(0);

Cell cell = null;
cell = my_worksheet.getRow(0).getCell(10);
cell.setCellValue(nme.getText());                              
cell = my_worksheet.getRow(3).getCell(6);
cell.setCellValue(frm.getText);
cell = my_worksheet.getRow(4).getCell(3);
cell.setCellValue(empid);

//Closing InputStream
input_document.close();

FileOutputStream output_file =new FileOutputStream(new File("C:PayslipG.xls"));

//write data
my_xls_workbook.write(output_file);
//closing stream
output_file.close();

谢谢!

推荐答案

推进到一个答案的一些意见 - Java的应该是平台和架构无关。除非你做特定平台的code,如AWT或Swing,不应该有运行平台之间的差异

Promoting some comments to an answer - Java should be platform and architecture agnostic. Unless you're doing platform-specific code, eg AWT or Swing, there shouldn't be any differences between runtime platforms

的一件事可以机之间的不同,但是,是类路径。请确保你真的有相同code和两台机器一样的罐子!

The one thing the can differ between machines, however, is the classpath. Make sure you really have the same code and the same jars on both machines!

一个可悲的是常见的问题是运行时,框架等,以默默的捆绑的Apache POI的过时副本瞒着你。如果您利用code的包含在Apache POI FAQ条目 ,你可以检查你真正使用在运行时其POI jar文件。

A sadly common problem is for runtimes, frameworks etc to silently bundle outdated copies of Apache POI without telling you. If you make use of the code included in the Apache POI FAQ Entry, you can check which POI jars you are really using at runtime.

根据的评论,那些罐子不是你认为你正在使用的人。按照这等POI FAQ ,不支持版本之间的混合POI罐子。删除旧POI罐子所确定,所以你只使用最新的孩子,和code将正确的行为

As per the comments, those jars aren't the ones you think you are using. As per this other POI FAQ, mixing POI jars between versions isn't supported. Remove the older POI jars as identified, so you only use the latest ones, and your code will behave correctly

这篇关于同一个Apache POI(EXCEL)code演戏不同,具体取决于系统类型(32位,64位)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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