The System.IO.Packaging namespace
Since I went to Devdays in Ghent, I wanted to make a xlsx (excel 2007) file. An excel 2007 file is just a zip container with a bunch of xml files.
Using the System.IO.Packaging namespace you can make such a package file.
Just add a reference to the windowsbase.dll assembly located in C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0 directory.
In fact to create an xlsx file, you first have to create a package. After creating the package, you have to make some relations.
- workbook relation
- worksheet relation
- sharedstringrelation
- styles relation (not neccessary if you do not want to use styles)
When the relations are created, you have to make the individual xml files.
At this moment I made a little assembly for converting a datatable to an xlsx file. In the following weeks, I will post some code snippets.
- Ken