Thursday, May 19, 2011

Excel Wrapper Dot Net

I hate working with Excel files, especially in C#. This wrapper makes things a little easier.
http://excelwrapperdotnet.codeplex.com/

But if you want to save as an xlsx rather than an xlxm then you'll get this error

"This extension can not be used with the selected file type. Change the file extension in the File name text box or select a different file type by changing the Save as type."

This is because in the source code, in the function SaveAs2007 it has the save coder written as:
            workbook.SaveAs(fullPath, 52,
                    missing, missing, false, false, Excel.XlSaveAsAccessMode.xlNoChange,
                    missing, missing, missing, missing, missing);

Change that 52 to a 51 and it will work.

1 comment:

Nik said...

As for me I have found standard library from microsoft site,
it is also wrapper and it works.

I did not test your variant, but others solutions from codeproject.com works unstable for me.