title: Problems opening .xlsx file created with EPPlus and zipped in a folder with ICSharpCode.SharpZipLib
body: <p>I am creating a list of ExcelPackages (xlsx documents) using EPPlus, and adding them to a ZipOutputStream as ZipEntries. I think the Excel documents should be valid, as I can open them just fine when I write one of them to the Response object without zipping.<br>
  The zip folder is created as expected, and the file(s) are there and doesnt seem to be empty, but when I try to open them I get the following error in Excel: </p>
  
  <blockquote>
    <p>Excel cannot open the file {Name}.xlsx because the file format or file extension is not valid. Verify that file has not been corrupted and that the file extension matches the format of the file</p>
  </blockquote>
  
  <pre><code>List&lt;ExcelPackage&gt; documents = new List&lt;ExcelPackage&gt;();
  List&lt;string&gt; fileNames = new List&lt;string&gt;();
  
  //Code for fetching documents and filenames here (removed for the sake of readability)
  
  Response.Clear();
  Context.Response.BufferOutput = false; 
  Response.ContentType = "application/zip";
  Response.AppendHeader("content-disposition", "attachment; filename=\"random-foldername.zip\"");
  Response.CacheControl = "Private";
  Response.Cache.SetExpires(DateTime.Now.AddMinutes(3)); 
  
  ZipOutputStream zipOutputStream = new ZipOutputStream(Response.OutputStream);
  zipOutputStream.SetLevel(3); //0-9, 9 being the highest level of compression
  byte[] buffer = null;
  
  for (int i = 0; i &lt; documents.Count; i++)
  {
      MemoryStream ms = new MemoryStream();
  
      documents[i].SaveAs(ms);
  
      ZipEntry entry = new ZipEntry(ZipEntry.CleanName(fileNames[i]));
  
      zipOutputStream.PutNextEntry(entry);
      buffer = new byte[ms.Length];
  
      ms.Read(buffer, 0, buffer.Length);
      entry.Size = ms.Length;
  
      ms.Close();
  
      zipOutputStream.Write(buffer, 0, buffer.Length);
      zipOutputStream.CloseEntry();
  
  }
  zipOutputStream.Finish();
  zipOutputStream.Close();
  
  Response.End();
  </code></pre>
  
  <p>As for the list of filenames, im just generating a name based on some arbitrary stuff and adding a ".xlsx"-extension to the end of it.</p>
  
  <p>Im not sure where im going wrong here, any suggestions?</p>