I am getting the following runtime exception:

     [java] Exception in thread "AWT-EventQueue-0"
java.lang.ClassCastException: org.apache.poi.hssf.usermodel.HSSFWorkbook
cannot be cast to org.apache.poi.ss.usermodel.Workbook
     [java]     at 
....ExportToExcelAction.getXLSWorkBook(ExportToExcelAction.java:153)

The code is this:

    private Workbook getXLSWorkBook() {        Workbook genericWorkbook =
null;        HSSFWorkbook wb = new HSSFWorkbook();
genericWorkbook = (Workbook)wb;        return genericWorkbook;    }

If I do this same thing for an XSSFWorkbook, it works fine. I have tried any
number of different ways to do this cast for HSSFWorkbook. Either the
compiler flags it or I get a runtime exception ­ no matter what, I haven¹t
figured out how to do this. This should work like XSSFWorkbook since they
both implement the Workbook interface.

I am using 3.5 Beta 5.

Any thoughts? Is this a bug?



> Carvel Baus
> Software Engineer, MTCSC
> 843-218-6197
> [email protected]
> 
> "The significant problems we face cannot be solved at the same level of
> thinking we were at when we created them."
>   --  Albert Einstein
> 



    

Important Notice: This email message and any attachments may contain 
information and/or trade secrets that are private, and are meant to be 
delivered solely for the use of the intended recipient(s). If you are not the 
intended recipient, please do not read, copy, use, forward or disclose the 
contents of this communication to others. Interception of e-mail is a crime 
under the Electronic Communications Privacy Act, 18 U.S.C. 2510-2522 and 
2701-2709. If you have received this email in error, please immediately notify 
us by return email or by telephone at [703-221-0200 Ext 51119] and promptly 
delete this message. Thank You.


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to