You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Sbryc <sa...@gmail.com> on 2012/11/10 14:42:54 UTC
xssf cell value end of zero
my cell value in excel : 123123000
my code:
XSSFWorkbook workBook = new
XSSFWorkbook(yuklenenExcelInputStream);
XSSFSheet sheet = workBook.getSheetAt(0);
Iterator iter = sheet.rowIterator();
while(iter.hasNext()){
XSSFRow row = (XSSFRow)iter.next();
System.out.println("row.getCell() = " + row.getCell());
}
result:
row.getCell() =1.23123E8
i don't want it
i want it that way
row.getCell() = 123123000
please help me!
thanks
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/xssf-cell-value-end-of-zero-tp5711448.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: xssf cell value end of zero
Posted by Sbryc <sa...@gmail.com>.
Thanks Nick.
i solved my problem. i added this codes
double d = cell.getNumericCellValue();
Long l = (new Double(d)).longValue();
thanks again
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/xssf-cell-value-end-of-zero-tp5711448p5711466.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: xssf cell value end of zero
Posted by Nick Burch <ap...@gagravarr.org>.
On Sun, 11 Nov 2012, Sbryc wrote:
> the result is still the same
> Does not matter as much as 7-digit numbers
> but i trying more than 7-digit numbers
> method of getCell converting scientific notation as 1.23123E8
What are you doing after calling getCell() ? Are you getting the type, and
then the double value, then formatting? And if so, are you doing a custom
format of the double or using DataFormatter? And if not, why not? ;-)
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: xssf cell value end of zero
Posted by Shuichen Zhang <zh...@yahoo.com>.
As Nick suggested, can you try the following code?
XSSFWorkbook workBook = new XSSFWorkbook(yuklenenExcelInputStream);
XSSFSheet sheet = workBook.getSheetAt(0);
Iterator iter = sheet.rowIterator();
while(iter.hasNext()){
XSSFRow row = (XSSFRow)iter.next();
if (row.getCell().getCellType() == Cell.CELL_TYPE_NUMERIC) {
System.out.println("Cell value = " + (new BigDecimal(Double.valueOf(row.getCell().getNumericCellValue()))).toPlainString());
}
}
Good luck.
--- On Sun, 11/11/12, Sbryc <sa...@gmail.com> wrote:
From: Sbryc <sa...@gmail.com>
Subject: Re: xssf cell value end of zero
To: user@poi.apache.org
Date: Sunday, November 11, 2012, 11:26 AM
thanks Nick,
although i trying it,
the result is still the same
Does not matter as much as 7-digit numbers
but i trying more than 7-digit numbers
method of getCell converting scientific notation as 1.23123E8
i know it's meaning 123123000 but i don't want to get 1.23123E8 by method of
getCell
because i am writing datas to excel and excel in the showing scientific
notation
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/xssf-cell-value-end-of-zero-tp5711448p5711451.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: xssf cell value end of zero
Posted by Sbryc <sa...@gmail.com>.
thanks Nick,
although i trying it,
the result is still the same
Does not matter as much as 7-digit numbers
but i trying more than 7-digit numbers
method of getCell converting scientific notation as 1.23123E8
i know it's meaning 123123000 but i don't want to get 1.23123E8 by method of
getCell
because i am writing datas to excel and excel in the showing scientific
notation
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/xssf-cell-value-end-of-zero-tp5711448p5711451.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: xssf cell value end of zero
Posted by Sbryc <sa...@gmail.com>.
thanks Nick,
although i trying it,
the result is still the same
Does not matter as much as 7-digit numbers
but i trying more than 7-digit numbers
method of getCell converting scientific notation as 1.23123E8
i know it's meaning 123123000 but i don't want to get 1.23123E8 by method of
getCell
because i am writing datas to excel and excel in the showing scientific
notation
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/xssf-cell-value-end-of-zero-tp5711448p5711452.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: xssf cell value end of zero
Posted by Nick Burch <ap...@gagravarr.org>.
On Sat, 10 Nov 2012, Sbryc wrote:
> XSSFRow row = (XSSFRow)iter.next();
> System.out.println("row.getCell() = " + row.getCell());
That's calling cell.toString(). You almost certainly want to switch on the
type, fetch the numeric value as a double and format it as needed
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org