.NET ExcelLibrary Export Problems - .XLS corruption

Posted by hamlin11 on Stack Overflow See other posts from Stack Overflow or by hamlin11
Published on 2010-04-29T21:39:41Z Indexed on 2010/04/30 4:17 UTC
Read the original article Hit count: 1334

Filed under:
|
|

The library is located here: http://code.google.com/p/excellibrary/

I'm using some basic code to create an .XLS file.

When I open the file in Excel 2007, I get the following errors:

alt text

I click yes, then I get:

alt text

And just for fun, here's the XML error details (not very helpful)

alt text

Here's the code that I'm using to generate the Excel file:

    Dim ds As New DataSet
    Dim dt1 As New DataTable("table 1")
    dt1.Columns.Add("column A", GetType(String))
    dt1.Columns.Add("column B", GetType(String))
    dt1.Rows.Add("test 1", "Test 2")
    dt1.Rows.Add("test 3", "Test 4")

    ds.Tables.Add(dt1)

    ExcelLibrary.DataSetHelper.CreateWorkbook("c:/temp/test1.xls", ds)

Note: I added a reference to the DLL provided by the project download page and have an "Imports ExcelLibrary.Office.Excel" to link up with it

Any ideas on what the corruption is and/or how to fix it?

Thanks

© Stack Overflow or respective owner

Related posts about .NET

Related posts about excel