title: Writing in memory XSSFWorkbooks to in memory zip
body: <p>I am reading db records and creating in memory XSSFWorksbook.</p>
  
  <p>Once this is done, I am writing this workbook to zip output stream. The zip is created properly, but xlsx file isn't generated property. In place of excel it creats folders and files like _rel, worksheets, sharedStrings, styles and workbook.xml</p>
  
  <pre><code>//Read records from db and create workbook
  public static XSSFWorkbook buildReportDocuement(int reportIndex,
      List&lt;Object&gt; result) throws IOException {
      XSSFWorkbook workbook = new XSSFWorkbook();
      XSSFSheet excelSheet = workbook.createSheet(REPORT_NAME_PREFIX);
      setExcelHeader(excelSheet);
      processActivityReportData(result, excelSheet);      
      return workbook;
  }
  
  //reading worksbooks into bytearray and addign to in memory zip files
  public static ByteArrayOutputStream zipWorkbooks(
      List&lt;XSSFWorkbook&gt; workbooks) throws IOException {
  
      int workBookIndex = 1;
      ByteArrayOutputStream byteOutputStream = null;
      FileOutputStream outputStream = new FileOutputStream("Reports");
      ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream);
      ZipEntry zipEntry = null;
  
      for (XSSFWorkbook current : workbooks) {
          zipEntry = new ZipEntry(REPORT_PREFIX + workBookIndex
              + EXCEL_EXTENSION);
          zipOutputStream.putNextEntry(zipEntry);
          byteOutputStream = new ByteArrayOutputStream();
          current.write(byteOutputStream);
          if (byteOutputStream != null) {
              zipEntry.setSize(byteOutputStream.size());
              zipOutputStream.write(byteOutputStream.toByteArray());
              zipOutputStream.closeEntry();
          }
      }
      zipOutputStream.close();
      return byteOutputStream;
  }
  </code></pre>
  
  <p>I am not supposed to write any of the files to file system. Please guid me.</p>