Ah, I get it, thanks Dave.

I converted my code to support both formats, using the interface classes
(Workbook, Sheet, etc), and it was quite easy - you guys did a great job.

A couple minor issues:

  1) The XSSF and HSSF Workbook constructors vary, I was using the
InputStream one for HSSF before.  Easy enough to work-around.

  2) I'm didn't find a a good way to get a FormulaEvaluator without checking
the instanceof for the workbook.

  3) I get a strange exception (hopefully a problem on my side):
      Exception in thread "Thread-4" java.lang.IncompatibleClassChangeError: 
      Class org.apache.poi.hssf.usermodel.HSSFWorkbook does not implement
the requested interface
      org.apache.poi.ss.usermodel.Workbook

      HSSFWorkbook clearly does implement that interface, so I'm not sure
what my problem is yet. 

      Workbook wb = new HSSFWorkbook (ssIn); // this line works fine
      if (wb.getNumberOfSheets() > 0)  // this line throws the exception

-J


David Fisher wrote:
> 
> Paul,
> 
> XLSX is supported by XSSF while XLS is supported by HSSF. In POI-3.5  
> there is a common "SS" model that combines the two. You will need to  
> use that to support both formats.
> 
> Please see this page: http://poi.apache.org/spreadsheet/converting.html
> 

-- 
View this message in context: 
http://www.nabble.com/Unable-to-open-Excel-2007-file-%28block--0---already-removed%29-tp22669473p22685301.html
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