Yogesh Jagota's Personal Blog
small c# code snippets and free code libraries

Excel Xml Library

Introduction

Just like any other Excel XML export article/library writer, my quest started when I wanted to export a simple report to Excel. I knew that writing a Excel XML library is very easy and I was sure I will find plenty of such libraries on the net. I did found many, but none of them was simple, yet intuitive, powerful and implemented everything I needed. I can take ages to write a background component like a export library, but when using it, I want it to do my work fast and without fuss. The library is compatible with .Net 2.0/3.0/3.5.

So I came with this library which is easy and fast to use, yet is very powerful to be considered to be one of the most powerful XML libraries present. I started it just as a export library but now it has full support of importing and modifying Excel Xml files.

Features

There are a multitude of features which are present in the library. They are...

  • Full import and export of Excel XML files
  • Access cells from anywhere including ExcelXmlWorkbook, Worksheet, Row and Cell
  • Full support for formulae and ranges
  • Imported files's formulae and ranges are parsed to Formula and Range instances
  • Multitude of Insert, Delete and Add functions available for ExcelXmlWorkbook, Worksheet, Row and Cell
  • Auto management of cell references in the book on any change made via any of the Insert, Delete and Add functions
  • Cell Collection class with complete support for Linq
  • Full support for styles in Worksheet, Row and Cell and even Range
  • No instance declaration. All the dirty work is done by the library
  • Cell ContentType, which enables you to know what the cell actually contains
  • Dataset to ExcelXmlWorkbook conversion facility
  • Absolute and Non-absolute Ranges and Named ranges
  • Auto filter
  • Cell Merge & Unmerge
  • GetEnumerator support for Worksheet, Row and Range
  • Very fast speed as everything is done via XmlWriter
  • Ability to freeze rows or columns or both
  • Almost all print options
  • Almost all style options
  • Many formatting options
  • Hidden columns and rows

Using the Library

For most of the documentation/examples to get you started with the library, look here.

Memory

I have optimized the library to use as little memory as I could. As far as the styles go, if you have a 100,000 cell workbook written programmatically, which contains only 10 individual styles, the number of styles in memory will be only 11, i.e. 10 separate styles + 1 default style. Although the styles are added on a book level, so if you have 10 books with 10 same styles present in all of them, the number of style instances active in the program will be 110.

Updates

  • [06 Mar 2008] Version 2.79
  • [20 Feb 2008] Version 2.43
  • [01 Feb 2008] Version 1.30
    • First release posted on this blog
  • Downloads