views:

32

answers:

2

Hi,

I wrote a Java method that uses POI HSSF API to convert an Excel file to my data structure. The code worked just fine for a while. But now there are suddenly problems. I suspect it might be because recently we installed Office 2007 on all the client computers (previously we had Office 2003).

The problem I run into is this: inside the xls file I have a column of cells that is filled with serial-numbers by the user (numeric values). When the java application gets the cell, it has a cell type STRING. And when I ask for the string value of the cell (in rich text string format) I get an empty string.

The file is originally created by the application, then the users fill it with data and load it back into the aplication. So I don't think the file format is wrong (since it's created by the same version of the API).

What could be the problem?

EDIT: Clarification: we upgraded Office installation to 2007, but the application still uses HSSF and xls format. Only the users open and edit the files with Office 2007. Is that a problem?

Thanks, Malki.

A: 

Have you checked if Excel automatically switched the cell type to NUMERIC when the user entered the value?
Excel has this annoying feature to "intelligently guess" what kind of value the user enters which then often causes a problem in POI.

Turismo
How can I check if Excel automatically switched the cell type?
Malki
http://www.j-walk.com/ss/excel/tips/tip62.htm
Jon Freedman
A: 

HSSF is the POI Project's pure Java implementation of the Excel '97(-2007) file format. XSSF is the POI Project's pure Java implementation of the Excel 2007 OOXML (.xlsx) file format.

read furthur http://poi.apache.org/spreadsheet/index.html

Paul
Is the above answer useful to you :)
Paul