Wednesday, 21 August 2013

EPPlus writes a file that can be viewed with Preview, but is empty in Excel

EPPlus writes a file that can be viewed with Preview, but is empty in Excel

I'm using MonoMac to write an Excel Helper program, using EPPlus to do the
heavy Excel lifting for me.
Right now, the writing of the file is done by this code snippet here:
var outputFile = new FileInfo(outputText.StringValue);
using (ExcelPackage outPackage = new ExcelPackage(outputFile))
{
ExcelWorksheet outSheet = outPackage.Workbook.Worksheets.Add("Data");
outSheet.Cells["A1"].Value = "hello";
}
outPackage.Save();
I'm trying to open the file in MS Office Mac 2008, but it's empty, even
though there clearly is something when I open it in preview and unzip it
and look at the xml files. Is it Excel that is the culprit here, if so, is
there something I can do to fix it?

No comments:

Post a Comment