poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörn Franke <jornfra...@gmail.com>
Subject Re: Apache POI : Problem with Excel updating
Date Sun, 09 Jul 2017 15:54:13 GMT
You need to provide more source code so that we can help you...
Sometimes excel formulates formula results as General/Text and not number. This would be one
possible out of several explanations.

> On 9. Jul 2017, at 17:51, Javen O'Neal <onealj@apache.org> wrote:
> 
> What version of POI are you using?
> 
> What is handleCell doing with the Cell? Are you trying to read the numeric
> value from a cell containing number stored as text?
> 
> Have you taken a look at:
> https://poi.apache.org/spreadsheet/quick-guide.html#Getting+the+cell+contents
> 
> 
> On Jul 9, 2017 5:40 PM, "Hehabr" <hehabr@web.de> wrote:
> 
> Apache POI : Problem with Excel updating,
> after the new values are written to the cells :
> java.lang.IllegalStateException: Cannot get a NUMERIC value from a STRING
> cell
> 
> What could be the problem? How to fix it?
> 
> 
> I work with 5 files, 3 of them work as they should, and 2 others do not.
> Workaround for 2 bad files:
> Runtime.getRuntime().exec("cmd /c start " + excel.getAbsolutePath());
> 
> 
> 
> //
> ---------------------------------------------------------------------------
> 
> // Here: new values are written into the cells
> 
> workbook.getCreationHelper().createFormulaEvaluator().evaluateAll();
> workbook.setForceFormulaRecalculation(true);
> 
> OutputStream output = new FileOutputStream(excel.getAbsolutePath());
> workbook.write(output);
> output.flush();
> output.close();
> 
> // Here, new values are subtracted from the cells,
> after Excel resolves with new values
> 
> 
> //
> ---------------------------------------------------------------------------
> 
> // Value in bad Cell: =B24
> 
> java.lang.IllegalStateException: Cannot get a NUMERIC value from a STRING
> cell
>        at org.apache.poi.xssf.usermodel.XSSFCell.typeMismatch(
> XSSFCell.java:1050)
>        at
> org.apache.poi.xssf.usermodel.XSSFCell.getNumericCellValue(
> XSSFCell.java:310)
>        at quicc.excel.api.ExcelHandlerXSSF.handleCell(
> ExcelHandlerXSSF.java:275)
>        at quicc.excel.api.ExcelHandlerXSSF.readCell(
> ExcelHandlerXSSF.java:251)
> 
> 
> 
> 
> 
> --
> View this message in context: http://apache-poi.1045710.n5.
> nabble.com/Apache-POI-Problem-with-Excel-updating-tp5728112.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

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message