poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 35288] New: - HSSFCell.setCellFormula(..) followed by setCellValue(..) throws ClassCastException
Date Thu, 09 Jun 2005 13:35:41 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35288>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35288

           Summary: HSSFCell.setCellFormula(..) followed by setCellValue(..)
                    throws ClassCastException
           Product: POI
           Version: 3.0-dev
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: amolweb@yahoo.com


Following code throws ClassCastException:

1        HSSFWorkbook workbook = new HSSFWorkbook();
2        HSSFSheet sheet = workbook.createSheet();
3        HSSFRow row = sheet.createRow(0);
4        HSSFCell cell = row.createCell((short) 0);
5        cell.setCellFormula("SUM(1,2)");
6        cell.setCellValue("TEST"); // EXCEPTION!!

It does not matter that the call to setCellValue sets String,
double or boolean. ie the following at line 6 above causes
the same error:

6        cell.setCellValue(true);
6        cell.setCellValue(1);

Notes:
In class HSSFCell,
setCellValue(..) methods do not call appropriate 
setCellType(..) if the cell type is CELL_TYPE_FORMULA 
- which is apparently desired behaviour. 
But before casting "instanceof XYZRecord" check is 
not performed which causes casting of FormulaRecordAggregate
to throw that exception.

Workaround:
  Calling setCellType explicitly prior to setCellValue
can prevent the problem... (but it prevents setting
initial values for formula cells, which is what I
was attempting)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


Mime
View raw message