0

I was googling this question, but couldn't find any solution to my problem. Sorry, if it is duplicate.

I am building *.xlsx file in my application. I want user after clicking the button at my Web GUI to have the file downloaded. I wrote smth like this:

XSSFWorkbook wb = new XSSFWorkbook(); 
//then setting values and styles.
ZipOutputStream zout = new ZipOutputStream(getOutputStream());
ZipEntry ze = new ZipEntry(fileName);
zout.putNextEntry(ze);
wb.write(zout);
zout.closeEntry();
zout.close();

After work of code like this I have *.zip archive, but it contains folders, xml files. I know that *.xlsx assembles from *.xml files, but I want to have correct *.xlsx file, not it's inner representation.

Please, tell me what am I doing wrong?

edward_wong
  • 442
  • 7
  • 21
  • Thats the problem, that I haven't actually xlsx file in my archive. I have there folders in zip archive like I had unzipped this xlsx file. – edward_wong Aug 28 '13 at 10:24
  • Do you have any advantage to save the XLSX binary content in a zip file since XLSX is already a zip archive having another extension in its file name? You will have no better compression. – Skrol29 Aug 28 '13 at 11:11
  • @geluinie: if the zip has xml and you want xlsx then why shouldn't you perform conversion from xml to xlsx. http://stackoverflow.com/a/15740758/624003 will be helpful for this. – Sankumarsingh Aug 28 '13 at 15:14
  • @Skrol29 there are some situations when there have to be more than one *.xlsx file in *.zip archive( – edward_wong Aug 28 '13 at 15:17
  • @Sankumarsingh thanks, but i think that it's unnecessary load on the app. – edward_wong Aug 28 '13 at 16:08

0 Answers0