Hi guys,

Thanks for the reply. My problem is that cell is defined as text. For some reason POI considers it as a numeric and adds '.0' to the text of the cell. If cell is Numeric I can only retrieve context of the cell by using xlsRow.getCell(colIdx).getNumericCellValue(). I have a mapping in my application which maps columns in the xls file to the database fileds. Let's say DB field defined as varchar(5). File contains 12345. POI adds '.0' the cell value and I am trying to insert '12345.0' into varchar(5).

So my question is why POI considers text cell with number in it as numeric(cell format defined as TEXT)

Thank you,
Feliks.



On Thu, Sep 13, 2012 at 3:49 PM, [email protected] wrote:

What is your question exactly? Is it that you want the value returned as a string with no decimals or are you encountering an error somewhere?



FELIX BERIG <[email protected]> wrote on 2012-09-13 01:46:23 PM:

FELIX BERIG <[email protected]> 2012-09-13 01:46 PM

Please respond to
"POI Users List" <[email protected]>

To

[email protected],
cc

Subject

POI 3.8 Invalid cell type


Hi All.

I recently upgraded to POI 3.8. I am having issue with cell type when trying to read xls file. The cell is defined as a text. But value in the

cell is numeric(5678). When I validate the cell type I can see that it is Cell.CELL_TYPE_NUMERIC and the value in the cell is 5678.0

Here is the code I have:
...
import org.apache.poi.ss.usermodel.Workbook;
....
Workbook workbook = null;
FileInputStream fileInputStream = new FileInputStream(fileName);
if(fileExt.equals("xls"){
    workbook = new HSSFWorkbook(fileInputStream);
}
if(fileExt.equals("xlsx"){
    workbook = new XSSFWorkbook(fileInputStream);
}
sheet = workbook.getSheetAt(0);
xlsRow = sheet.getRow(0);

etc....


Am I doing  something wrong?

Thank you,
Feliks.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to