I am using EPPlus to generate an XLSX file in C#. As soon as I instantiate the ExcelPackage with a memory stream - I get the error:
\"A disk error occ
We had a similar issue when converting code that used the 4.1.1 version of EPPlus to the 4.5.1 version.
Originally, we were using the following pattern:
using (var ms = new MemoryStream())
{
new ExcelBuilder().BuildResultFile(result, ms);
ms.Position = 0; // <-- Cannot access a closed Stream error thrown here
// Send Excel file to Azure storage
}
And our ExcelBuilder class, BuildResultFile function:
public void BuildResultFile(List resultSets, Stream stream)
{
using (var package = new ExcelPackage(stream))
{
// Create Excel file from resultSets
package.Save();
}
}
In order to make this work with 4.5.1 we had to remove using block from the BuildResultFile
function.
I can't seem to find any documentation on in GitHub w/r/t why this changed or if I am even implementing this correctly.