Quantcast
Channel: Java Programming Forum - Learn Java Programming - Apache POI
Viewing all articles
Browse latest Browse all 120

Your InputStream was neither an OLE2 stream, nor an OOXML stream

$
0
0
I am using Apache Commons to upload a .docx . While uploading, I also want to extract text by using Apache POI libraries.

If I pass the inputstream returned from item.openStream(); from ServletFileUpload to POI API,I get the exception:java.lang.IllegalArgumentException: Your InputStream was neither an OLE2 stream, nor an OOXM

public static String docx2text(InputStream is) throws Exception {
return ExtractorFactory.createExtractor(is).getText();
}

my application server does not allow me to write to file, so I cannot use FileInputStream.

how do I handle this? I am uploading valid .docx file.There are no issues with uploading file.

-regards
Ma

Viewing all articles
Browse latest Browse all 120

Trending Articles