Changed the code to use CellValue instead of using evaluateInCell. and its
working...

HSSFFormulaEvaluator.CellValue cellValue = evaluator.evaluate(cell);

switch (cellValue.getCellType()) {

Not sure what was the issue in using evaluator.evaluateInCell

Thanks,
Ram

bofa wrote:
> 
> Hi All,
> 
> I am having a problem while trying to evaluate a formula in POI.
> 
> My Excel File formula's are pretty straight forward  (=E2) , Interesting
> part is formulas work if E2 contains a Numeric value, but not working if
> E2 contains a String.
> 
> code Snippets::
> 
> //Formula Evaluator
>                       HSSFFormulaEvaluator evaluator = new 
> HSSFFormulaEvaluator(sheet,
> workBook);
> 
>                               evaluator.setCurrentRow(row);
> 
>  On the below line I am getting an error message.
> switch (evaluator.evaluateInCell(cell).getCellType()) {
> 
> 
> ERROR : 
> java.lang.ClassCastException
>       at 
> org.apache.poi.hssf.usermodel.HSSFCell.setCellValue(HSSFCell.java:585)
>       at
> org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateInCell(HSSFFormulaEvaluator.java:236)
> 
> I saw few guys having same problem in the net but there are no replies
> available , Intially used "poi-scratchpad-3.0.1-FINAL-20070705" jar also
> tried poi-scratchpad-3.0-rc4-20070503.
> 
> Any help would be appreciated.
> 
> 
> Thanks,
> Ram
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Class-Cast-Exception-in-HSSFFormulaEvaluator.java%3A236-tf4939649.html#a14140393
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to