title: Save as using EPPlus?
body: <p>Does any one know how to use the package.Saveas function?</p>
  
  <pre><code>package.SaveAs(tempFolderPathAlt + saveas + ".xlsx");
  </code></pre>
  
  <p>At the moment this is underlined in red with the following error:</p>
  
  <blockquote>
    <p>The best overloaded method match for
    'OfficeOpenXml.ExcelPackage.SaveAs(System.IO.Stream)' has some invalid
    arguments</p>
  </blockquote>
  
  <p>At the moment i'm saving the file in the following way.</p>
  
  <pre><code>FileStream aFile = new FileStream(tempFolderPathAlt + saveas + ".xls",    FileMode.Create);
  byte[] byData = package.GetAsByteArray();
  aFile.Seek(0, SeekOrigin.Begin);
  aFile.Write(byData, 0, byData.Length);
  aFile.Close();
  </code></pre>
  
  <p>But this way the package remains open and i cant work with files it has used.</p>
  
  <p>The save as will close the package properly, but its not accepting my file path.</p>
  
  <hr>
  
  <p><strong>Edit</strong></p>
  
  <p>I tried this:</p>
  
  <pre><code>using (FileStream aFile = new FileStream(tempFolderPathAlt + saveas + ".xlsx", FileMode.Create))
  {
      byte[] byData = package.GetAsByteArray();
      aFile.Seek(0, SeekOrigin.Begin);
      package.SaveAs(aFile);
      //aFile.Write(byData, 0, byData.Length);
      aFile.Close();
  }
  </code></pre>
  
  <p>But Get the following error?</p>
  
  <p>Package object was closed and disposed, so cannot carry out operations on this object or any stream opened on a part of this package.</p>