How to convert xlsx files into 2003 xls files programatically in C#?

前端 未结 4 1694
遥遥无期
遥遥无期 2021-01-03 12:39

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 wi

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-03 13:16

    You can try to use Microsoft.Office.Interop.Excel. You will need to have Excel installed on the machine that is trying to do the conversion. You can add the reference from the COM tab and use the Microsoft Excel 12.0 Object Library component.

    Basically, you will open up the existing workbook using Workbook.Open(), create a new Worksheet and copy over the existing data. You can then use the Workbook.SaveAs() method, this will let you set the file format in the 2nd parameter.

提交回复
热议问题