• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
h dumbre
Greenhorn
Posts: 5
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3268
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3268
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!