• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 5
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic