Sample code for generating a SpreadsheetML file

Doug Mahugh has another post on programmatically generating a basic Office Open XML file. This latest post shows how to create a simple SpreadsheetML file:

This post covers the code for a CreateXlsx program that creates a simple Open XML spreadsheet from scratch using the .NETĀ Framework 3.0 packaging API (System.IO.Packaging), as well as two of the Open XML code snippets that are available on MSDN.Ā  Full source code for this sample is provided in the attached ZIP file.

While Doug's code uses System.IO.Packaging, you could also do the same thing with any XML and ZIP library. There was an example up on that demonstrated how to manipulate the files using Java code. Since the Open Packaging Conventions are going to be part of the Ecma spec, it shouldn't take much time for folks to build tools like System.IO.Packaging to make it that much easier to develop on top of the file formats.