aspose file tools*
The moose likes Other Open Source Projects and the fly likes having proble to remove password protection from large xlsx file using poi 3.8 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "having proble to remove password protection from large xlsx file using poi 3.8" Watch "having proble to remove password protection from large xlsx file using poi 3.8" New topic
Author

having proble to remove password protection from large xlsx file using poi 3.8

h dumbre
Greenhorn

Joined: Feb 22, 2013
Posts: 5

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);
wb.write(fi);
fi.close();


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
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2366
    
  50
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
h dumbre
Greenhorn

Joined: Feb 22, 2013
Posts: 5

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 .



Thanks
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2366
    
  50
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.
 
wood burning stoves
 
subject: having proble to remove password protection from large xlsx file using poi 3.8