Forums Register Login
having proble to remove password protection from large xlsx file using poi 3.8
Hi All,

I m using POI.3.8 , i have one requirement to strip the password from xlsx file.
I m using following code,

POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(path));
EncryptionInfo info = new EncryptionInfo(fs);
Decryptor d = Decryptor.getInstance(info);
if (d.verifyPassword(password)) {
XSSFWorkbook wb = new XSSFWorkbook(d.getDataStream(fs));
FileOutputStream fi = new FileOutputStream(path);

It is working fine with me for 2-5 MB file ,but some input files are more than 50MB , it taking more time and also giving OutOffMemoryException,then i increase my ram size to 8GB but still no luck...

Please help me if some one knows any solution for this

Thanks in advance
Welcome to the Ranch.

I think you may have to use SXSSF. See this article on how to use it http://poi.apache.org/spreadsheet/how-to.html#sxssf
Hello Tony,

Thanks for your quick reply,

XSSFWorkbook wb = new XSSFWorkbook(d.getDataStream(fs));

in this code d.getDataStream(fs) returns input stream, but it seems to no such constructor of SXSSF to accept InputStream .

May be i m wrong some where , can you please suggest or give idea to how to use SXSSF instead of XSSFWorkbook .

Yes, there is one that takes a XSSFWorkbook but I that is of no use to you.
Sorry but I've only done basic stuff using POI, maybe someone else with more experience will be able to provide better help.
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards

This thread has been viewed 1470 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jan 17, 2018 15:23:59.