Tampa Code Camp presentation November 15, 2010
At the 2010 Tampa Code Camp I gave a presentation on using the Open XML SDK to generate documents and reports. It was an overview of the benefits of using the SDK over other reporting tools like SQL Reporting Services (SSRS) and Crystal Reports. The main advantages of the SDK are:
- The Open XML SDK Tool is a great resource that most of the time will help you identify 80% of the SDK code that you will need to write in order to generate a Word Document (docx) and other document types covered by the Office Open XML File Format Specification.
- It only requires 2 assembly references to get started: DocumentFormat.OpenXml and WindowsBase. In my experience the second assembly is only required if you are going to handle disposing of the WordprocessingDocument object gracefully with a using statement. Which I would highly recommend. Any time something implements IDisposable a using statement should be a must.
- Business logic can be reused since the SDK code that you write is just another assembly in your application. I think this is a huge advantage over SSRS and Crystal. Although SSRS is making strides with each new version as it comes out, without some heart ache, you still can’t easily reference a .NET assembly.
- The SDK classes are strongly typed and can be navigated and manipulated using LINQ and Lambda Expressions. This is great because it means you are dealing with a document and it’s collections of items and not a document and it’s many xml nodes.
For more on this presentation download the slides and accompanying code here
Note: In order to conserve space in each of the demo projects I removed assembly references to the AJAX tool kit, and the Free Text Box.
You can get them here: