java.lang.ClassCastException: org.apache.poi.hssf.record.LabelRecord java.util.TreeMap.compare(TreeMap.java:1093) java.util.TreeMap.put(TreeMap.java:465) org.apache.poi.hssf.record.aggregates.ValueRecordsAggregate.insertCell (ValueRecordsAggregate.java:65) org.apache.poi.hssf.record.aggregates.ValueRecordsAggregate.construct (ValueRecordsAggregate.java:130) org.apache.poi.hssf.model.Sheet.createSheet(Sheet.java:210) org.apache.poi.hssf.usermodel.HSSFWorkbook.<init> (HSSFWorkbook.java:172) org.apache.poi.hssf.usermodel.HSSFWorkbook.<init> (HSSFWorkbook.java:130) org.springframework.web.servlet.view.document.AbstractExcelView.getTemp lateSource(AbstractExcelView.java:165) org.springframework.web.servlet.view.document.AbstractExcelView.renderM ergedOutputModel(AbstractExcelView.java:132) org.springframework.web.servlet.view.AbstractView.render (AbstractView.java:250) While trying to use the template already given by Client which has Gaphs an dthe base data
Created attachment 18847 [details] this is the template i want to use
Created attachment 19767 [details] Proposed fix to kludge for LabelRecord data type The current kludge for converting out-dated LabelRecords to LabelSSTRecords generated ClassCastExceptions when I tried to read a spreadsheet created by MS Works, supposedly saved in Excel 97/2000 format. The problem appears to be that the conversion method : sheet.convertLabelRecords(workbook); is called too late in the sequence. By the time it is called, the records have already been processed, and it is during that processing that the exception fails. The specific issue is that LabelRecord does not implement Comparator interface, but there is a secondary problem that the LabelRecords are inserted into a second data structure (ValueRecordsAggregate cells) during that process and those entries are not converted to LabelSSTRecords during the conversion. I believe the better way to handle this is to do the conversion in usermodel.HSSFWorkbook.java prior to creating the Sheet objects. This appears to work for me. The code changes in the attached file are located between line numbers 170 and 210. They do the conversion on the records structure and comment out the call to convertLabelRecords in Sheet. That method might be eliminated if this patch is applied.
Retested OK in 3.1-beta1. Probably fixed in svn r353774 (for bug 19053) *** This bug has been marked as a duplicate of bug 19053 ***