How can I help you?
How to convert xls document to xlsx format document?
24 Jun 20262 minutes to read
The following code illustrates how to convert xls document to xlsx format document.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
//Loads an xls file
IWorkbook workbook = application.Workbooks.Open("InputTemplate.xls");
//Set the workbook version to xlsx
workbook.Version = ExcelVersion.Xlsx;
//Saving the workbook in xlsx format
workbook.SaveAs("Output.xlsx");
}using (ExcelEngine engine = new ExcelEngine())
{
IApplication application = engine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
//Loads an xls file
IWorkbook workbook = application.Workbooks.Open("InputTemplate.xls");
//Set the workbook version to xlsx
workbook.Version = ExcelVersion.Xlsx;
//Saving the workbook in xlsx format
workbook.SaveAs("Output.xlsx");
}Using engine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = engine.Excel
application.DefaultVersion = ExcelVersion.Xlsx
'Loads an xls file
Dim workbook As IWorkbook = application.Workbooks.Open("InputTemplate.xls")
'Set the workbook version to xlsx
workbook.Version = ExcelVersion.Xlsx;
'Saving the workbook in xlsx format
workbook.SaveAs("Output.xlsx")
End Using