-- EDIT --
Apparently the library takes everything from an existing file, this includes empty files. (Line 5 of my code.)
So for some reason, using an empty file the relation between _root_ and _/xl/workbook.xml_ isn't created.
__I propose a better check when writing the file away.__
-- ORIGINAL --
Hi guys,
I'm new to EEPlus and already running into beginner issues. I want to use EPPlus for local use, no ASP.NET.
Simply creating a file and adding a worksheet creates a corrupted file. I followed some tutorials and ended up all corrupted. While their comments are all good.
I've included the basic method I use to test EPPlus. Please review it.
```
static void Main(string[] args)
{
var fi = new FileInfo("example.xlsx");
if (fi.Exists) fi.Delete();
fi.Create().Close();
// Create the package and make sure you wrap it in a using statement
using (var package = new ExcelPackage(fi))
{
// add a new worksheet to the empty workbook
var sheet = package.Workbook.Worksheets.Add("Sheet1");
// save our new workbook and we are done!
package.Save();
}
}
```
Apparently the library takes everything from an existing file, this includes empty files. (Line 5 of my code.)
So for some reason, using an empty file the relation between _root_ and _/xl/workbook.xml_ isn't created.
__I propose a better check when writing the file away.__
-- ORIGINAL --
Hi guys,
I'm new to EEPlus and already running into beginner issues. I want to use EPPlus for local use, no ASP.NET.
Simply creating a file and adding a worksheet creates a corrupted file. I followed some tutorials and ended up all corrupted. While their comments are all good.
I've included the basic method I use to test EPPlus. Please review it.
```
static void Main(string[] args)
{
var fi = new FileInfo("example.xlsx");
if (fi.Exists) fi.Delete();
fi.Create().Close();
// Create the package and make sure you wrap it in a using statement
using (var package = new ExcelPackage(fi))
{
// add a new worksheet to the empty workbook
var sheet = package.Workbook.Worksheets.Add("Sheet1");
// save our new workbook and we are done!
package.Save();
}
}
```