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

Excel Xml Library 2.45 released

Wednesday, 20 February 2008 01:49 by Yogesh Jagota

Excel Xml Library version 2.45 is released.

Fixes from 2.43

  • 2.45: Fixed a error where GetValue<T>() was not accepting string and DateTime types. Thanks to Karl for pointing this out.
  • 2.44: Fixed a error where assigning 0 to a Cell caused a exception. Thanks to Ralf for pointing this out.

New Features

  1. Complete Import of Excel Xml files are supported. All the formulae are parsed to Formula instances and all formula parameters which are ranges or formulae are parsed to their respective instances. If a formula cannot be parsed, it is not lost. It is saved as a unresolved value and is exported as it was previously stored, with no error at all.

  2. Modification of a book is now possible using many Insert, Delete and Addition functions available in ExcelXmlWorkbook, Worksheet and Row classes.

  3. If any modification is done, all the ranges in the book (stored as formula parameters or stored as direct cell references in others cells) automatically update their respected cell references. If a range contains a cell which is deleted, the range returns #N/A.

  4. Empty cells are not written to the file. ss:Index attribute is used instead to bypass empty cell references.

  5. Cell now contain a ContentType readonly field which can be used to check what value type the cell contains. Available values are String, Number, Boolean, DateTime, Formula, UnresolvedValue. UnresolvedValue can be retrieved by using GetValue<string>(). Look below to learn about GetValue<T>.

  6. Worksheets can be accessed via Worksheet names.

  7. Rows can also be hidden now just as cells.

  8. The library is divided into two parts. A Yogesh.ExcelXml library and a Yogesh.Extensions library. The later contains a multitude of extension and helper functions for strings, enums, files etc. More on this very library very soon. Although you only need to make a reference of Yogesh.ExcelXml library to work, the other library i.e. Yogesh.Extensions needs to be present in the same directory.

For a full brief list of features, look here. For a detailed feature set, download the documentation from the page mentioned.

Breaking Changes

Changes which will break previous code when used with this new version are: 

  1. Output file or stream is not passed when the ExcelXmlWorkbook instance is created. It is passed with Export instead.

  2. Export method now only takes the output file or stream. If any error occurs, the function simply returns false and there is no way to find out what error occurred. No retry message box is displayed as was displayed previously. So the preferred way of export is to pass a stream because it gives you more control with error management.

  3. Cell's Value property is now a write only property.

  4. LogicalValue, NumericValue and DateTimeValue are no longer available. A new readonly property GetValue<T> is added which returns the cell value converted to the type supplied. You can use ContentType with GetValue<T> to retrieve the exact value of a cell. GetValue<T> enables strict type checking when retrieving a cell value. Further, if the type supplied with GetValue<T> does not matches the type of the cell type, default(T) is returned instead. For example: if a cell's ContentType == ContentType.Numeric, the only way to retrieve value of the cell is to supply byte, sbyte, int, uint, ... etc. If a cell's ContentType == ContentType.String, the only way to retrieve value of the cell is to supply string. You got the idea!!

  5. DataSetToWorkbook takes only DataSet as a parameter now.

  6. External book references are now not allowed. Previously you could write code like this:

    <
       1:  ExcelXmlWorkbook book1 = new ExcelXmlWorkbook();
       2:      ExcelXmlWorkbook book2 = new ExcelXmlWorkbook();
       3:      book1[0][0,0] = book2[0][0,0];

    Now you cannot.

See the updated library usage page for more information on how to use the library.

Downloads

Del.icio.usDigg It!DZone It!kick it on DotNetKicks.com
Tags:  
Categories:   Excel Xml Library
Actions:   E-mail | Permalink | Comments (9) | Comment RSSRSS comment feed

Comments

Add comment


 

biuquote
Loading