xls - java.lang.IllegalArgumentException: Your InputStream was neither an OLE2 stream, nor an OOXML stream -


when i'm reading excel file(.xls format), keep getting exception :

java.lang.illegalargumentexception: input stream neither ole 2 stream, nor ooxml stream. 

i go-ogled , found if input stream not supporting reset or mark, should wrap pushbackstream. input stream not mark\reset supported.

so using pushbackstream option? how use it? , whats use of it?

thanks

your inputstream neither ole2 stream, nor ooxml stream java.lang.illegalargumentexception: inputstream neither ole2 stream, nor ooxml stream 

i guess using workbook factory or different format input file , different workbook type. error pops when not able not able read file type. apache poi not check file extension. if open in text editor, you'll see instead it'll in different format. or might initializing workbook type hssf or xssf, before using workbook factory.

simpler solution open file using microsoft excel , save file(using file>save option microsoft excel > menu).

workbook factory not check file extension, instead checks file mime type. excel works different files(eg: files created using third party applications, excel 2003 version), apache poi specific.

pushbackinputstream adds "push back" or "unread" functionality input stream. allows read ahead few bytes see coming, before can determine how interpret current byte.

if not using workbook factory, pushbackinputstream alternative guess.

if can share code here can test , reconfirm it.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -