On Fri, 27 Apr 2012, Rafael wrote:
with xls file, it's work perfectly.

this is my code for xls file (work):
arquivoExcel = new POIFSFileSystem( new BufferedInputStream( new
FileInputStream(getArquivo())));
planilha =  new HSSFWorkbook(arquivoExcel);

this is code for xlsx (not works):

InputStream is = new FileInputStream(getArquivo());
Workbook planilhaXlsx = new XSSFWorkbook(is);

That ought to work ok, but you'd be much better off passing the File object to WorkbookFactory. That'll handle opening the appropriate HSSF or XSSF for you, and is lower memory than opening from a stream. Oh, and you'll want to upgrade to POI 3.8 final too

I try to use "POIFSFileSystem", but, its don't work too.

No, it won't. POIFSFileSystem is for the OLE2 based formats, XLSX is OOXML

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to