You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by Pavel Krupets <pk...@yahoo.com> on 2007/09/11 16:42:07 UTC

HSSFFormulaEvaluator::evaluateInCell problems.

Hello,

In HSSFFormulaEvaluator::evaluateInCell the following case blocks
don't change cell type which lead to class cast exception.

case HSSFCell.CELL_TYPE_BOOLEAN:
  cell.setCellValue(cv.getBooleanValue());
  break;
case HSSFCell.CELL_TYPE_ERROR:
  cell.setCellValue(cv.getErrorValue());
  break;
case HSSFCell.CELL_TYPE_STRING:
  cell.setCellValue(cv.getRichTextStringValue());
  break;

Like cell.setCellValue(cv.getRichTextStringValue()) will check inside
if type is not string and not formula then change type. 

if ((cellType != CELL_TYPE_STRING ) && ( cellType !=
CELL_TYPE_FORMULA))
{
  setCellType(CELL_TYPE_STRING, false, row, col, styleIndex);
}

And if it's formula it will still invoke code like this: 
(( LabelSSTRecord ) record).setSSTIndex(index). 
LabelSSTRecord isn't there and this results in class cast exception.

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


Re: HSSFFormulaEvaluator::evaluateInCell problems.

Posted by Nick Burch <ni...@torchbox.com>.
On Tue, 11 Sep 2007, Pavel Krupets wrote:
> In HSSFFormulaEvaluator::evaluateInCell the following case blocks don't 
> change cell type which lead to class cast exception.

OK, I've committed a change to correctly set the types

Nick

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