Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions File-Formats-toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -1689,6 +1689,7 @@
<li><a href="/file-formats/xlsio/faqs/how-to-set-logarithmic-axis-for-chart-in-excel-document">How to set Logarithmic axis for chart in Excel document?</a></li>
<li><a href="/file-formats/xlsio/faqs/how-to-resolve-performance-issue-when-deleting-a-large-number-of-rows">How to resolve performance issue when deleting a large number of rows?</a></li>
<li><a href="/file-formats/xlsio/faqs/how-to-hide-columns-using-column-name">How to hide columns using column name?</a></li>
<li><a href="/file-formats/xlsio/faqs/how-to-convert-xls-document-to-xlsx-format-document">How to convert xls document to xlsx format document?</a></li>
</ul>
</li>
</ul>
Expand Down
3 changes: 2 additions & 1 deletion File-Formats/XlsIO/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,5 @@ The frequently asked questions in Essential XlsIO are listed below.
* [How to fix the ArgumentOutOfRangeException when accessing a large number of rows and columns?](faqs/how-to-fix-the-argument-out-of-range-exception-when-accessing-a-large-number-of-rows-and-columns)
* [How to set Logarithmic axis for chart in Excel document?](faqs/how-to-set-logarithmic-axis-for-chart-in-excel-document)
* [How to resolve performance issue when deleting a large number of rows?](faqs/how-to-resolve-performance-issue-when-deleting-a-large-number-of-rows)
* [How to hide columns using column name](faqs/how-to-hide-columns-using-column-name)
* [How to hide columns using column name?](faqs/how-to-hide-columns-using-column-name)
* [How to convert xls document to xlsx format document?](faqs/how-to-convert-xls-document-to-xlsx-format-document)
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: How to convert xls document to xlsx format document |Syncfusion.
description: This page explains how to convert xls document to xlsx format document using Syncfusion .NET Excel library (XlsIO).
platform: file-formats
control: XlsIO
documentation: UG
---

# How to convert xls document to xlsx format document?

The following code illustrates how to convert xls document to xlsx format document.

{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;

//Loads an xls file
FileStream fileStream = new FileStream("InputTemplate.xls", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(fileStream);

//Set the workbook version to xlsx
workbook.Version = ExcelVersion.Xlsx;

//Saving the workbook as stream in xlsx format
FileStream stream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAs(stream);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please set workbook version to Xlsx before saving.

stream.Dispose();
}
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
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");
}
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
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
{% endhighlight %}
{% endtabs %}