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.