Convert xls to xlsx and xlsx to xls


  • I've found ExcelPackage, a better library than Excel Interop API to create and mantain programatically excel sheets, but they are generated in .xlsx. Most of people that will see the files have only office 2003 installed, so I need to convert, in my C# code, the final result into a .xls file.

    Do you know any way to do it in C# code?

    Thursday, August 12, 2010 6:59 AM


All replies

  • It's not possible with the OOXML SDK.  You'd have to use the standard Excel PIA to save the workbook as an XLS formatted file.
    Thursday, August 12, 2010 7:14 AM
  • Hi Rajnikant,


    Welcome to MSDN forums!

    I am interested in helping.

    I find a link about Xls and Xlsx, I’d like to share with you.

    Hope these helps, if you have any problems, please feel free to let me know.


    Best Regards,

    Alan Chen


    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    Friday, August 13, 2010 8:55 AM
  • I know this is a year old,  but I'm looking to do the same thing.  Did you ever find a solution to converting xlsx to xls in C# code?  I have been trying to use the compatibility pack tool (excelcnv.exe) but that does not seem to be working.
    Thursday, July 28, 2011 8:06 PM
  • So no one has got a solution yet to convert XLSX to XLS programatically.... So thats what we call as microsoft..... IS there anyone out there to help those developers who develope with microsoft products..... bcoz m one of them.... PLEASE HELP!!!!!!!!!!!!!!!!!!!!!!!!
    Thursday, November 17, 2011 6:07 AM
  • Here is a simple code that you can use to convert XLSX to XLS:

    // Create new XLSX file.
    var xlsxFile = new ExcelFile();
    // Load data from XLSX file.
    xlsxFile.LoadXlsx(fileName + ".xls", XlsxOptions.PreserveMakeCopy);
    // Save XLSX file to XLS file.
    xlsxFile.SaveXls(fileName + ".xls");

    This code uses following Excel C# library.

    Tuesday, June 12, 2012 7:49 AM
  • hi,

    I have a windows application using c#.We have created a .xls but i want to convert it to .xlsx file.

    Microsoft office 2010 will be installed on client machine.but i want to do this conversion without having the need of any sort of installation on client machine.Do we have any option of converting using some dll's rather than making this conversion version dependent.

    Please help me in the same.

    Thanks & Regard's

    Seema Sharma

    seema sharma

    Friday, July 26, 2013 6:27 AM
  • What about netoffice ?

    I search for xls files and convert them to xlsx so i can use ClosedXML to process the files (ClosedXML reads only xlsx).  Works ok with client applications, if its ok for you to use your office for the convertion.

    Tuesday, April 22, 2014 8:02 PM