Quantcast
Channel: EPPlus Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 2262

Edited Unassigned: New file corrupt [15536]

$
0
0
-- 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();
}
}
```

Viewing all articles
Browse latest Browse all 2262

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>