You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by FELIX BERIG <fb...@optonline.net> on 2012/09/13 19:46:23 UTC

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: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: POI 3.8 Invalid cell type

Posted by "Gandhi, Kunal - External" <KG...@sjm.com>.
It would help if you post the line of code where the error is occurring. And also, what the actual error it is that is occurring. If the cell is value is numeric, don’t use a cell that is defined as text.

-----Original Message-----
From: FELIX BERIG [mailto:fberig@optonline.net]
Sent: Thursday, September 13, 2012 12:46 PM
To: user@poi.apache.org
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: user-unsubscribe@poi.apache.org For additional commands, e-mail: user-help@poi.apache.org


This communication, including any attachments, may contain information that is proprietary, privileged, confidential or legally exempt from disclosure. If you are not a named addressee, you are hereby notified that you are not authorized to read, print, retain a copy of or disseminate any portion of this communication without the consent of the sender and that doing so may be unlawful. If you have received this communication in error, please immediately notify the sender via return e-mail and delete it from your system.

Re: POI 3.8 Invalid cell type

Posted by Lo...@log-net.com.
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 <fb...@optonline.net> wrote on 2012-09-13 01:46:23 PM:

> FELIX BERIG <fb...@optonline.net> 
> 2012-09-13 01:46 PM
> 
> Please respond to
> "POI Users List" <us...@poi.apache.org>
> 
> To
> 
> user@poi.apache.org, 
> 
> 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: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>