NExcelAPI - a .NET port of JExcelAPI

June 22nd, 2007
 JExcelAPI is a neat "Java API to read, write, and modify Excel spreadsheets", written by Andy Khan. It is very easy to use and it does a great job. Unfortunately, at work I have to deal with .NET projects as well. I thought it would be great to take advantage of the JExcelAPI's functionality in my .NET projects too, and get rid of the Microsoft Interop crap.

Thankfully, porting JExcelAPI to .NET was a piece of cake because all source files could be easily imported into a J# class library project, and compile with nothing but slight changes. To use it, download the visual studio solution and build the class library (you will need vs 2005). If you are not familiar to JExcelAPI, you can take a glance at the Test C# project do get an idea of how it works. However, make sure that you read the tutorial. Javadoc is also available.

I want to clarify that I did nothing more than drag'n'drop the original java files into a J# project. All glory and honour goes to Andy Khan. Thank you Andy.

3 Responses to “NExcelAPI - a .NET port of JExcelAPI”

  1. Danny Says:
    Very cool! Thank you.

    Just... when i use the code like this:

    java.io.File templatefile = new java.io.File("d:\\dokimi.xls");
    java.io.File outputfile = new java.io.File("d:\\output.xls");
    jxl.Workbook wb = Workbook.getWorkbook(templatefile);
    WritableWorkbook wwb = Workbook.createWorkbook(outputfile, wb); //Import the xls file as a template.
    //do nothing
    wwb.write();
    wwb.close();

    it works, but i got two warning message boxes while the output xls file is opening:
    "File error:data may have been lost"
    and
    "File error. Some number formats may have been lost."
    Cliked "OK", the file can be opened finally.
  2. Michael Tutty Says:
    This might be hard to believe but this code is still relevant. I've been using the jExcelAPI lib for several months and needed a .NET analog.

    For those without the J# module installed in VS.NET, you can use the following NAnt build instead:


  3. Michael Tutty Says:
    (Hm, seems to have been cut off...

    This might be hard to believe but this code is still relevant. I've been using the jExcelAPI lib for several months and needed a .NET analog.

    For those without the J# module installed in VS.NET, you can use the following NAnt build instead:

Leave a Reply