Skip to content

Commit c514461

Browse files
authored
Merge pull request #2076 from syncfusion-content/882003-Xls-to-Xlsx
882003 - Add FAQ for how to convert xls to xlsx document.
2 parents cff6020 + 5b87e32 commit c514461

File tree

3 files changed

+69
-1
lines changed

3 files changed

+69
-1
lines changed

File-Formats-toc.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,6 +1689,7 @@
16891689
<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>
16901690
<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>
16911691
<li><a href="/file-formats/xlsio/faqs/how-to-hide-columns-using-column-name">How to hide columns using column name?</a></li>
1692+
<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>
16921693
</ul>
16931694
</li>
16941695
</ul>

File-Formats/XlsIO/FAQ.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,5 @@ The frequently asked questions in Essential XlsIO are listed below.
8383
* [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)
8484
* [How to set Logarithmic axis for chart in Excel document?](faqs/how-to-set-logarithmic-axis-for-chart-in-excel-document)
8585
* [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)
86-
* [How to hide columns using column name](faqs/how-to-hide-columns-using-column-name)
86+
* [How to hide columns using column name?](faqs/how-to-hide-columns-using-column-name)
87+
* [How to convert xls document to xlsx format document?](faqs/how-to-convert-xls-document-to-xlsx-format-document)
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
title: How to convert xls document to xlsx format document |Syncfusion.
3+
description: This page explains how to convert xls document to xlsx format document using Syncfusion .NET Excel library (XlsIO).
4+
platform: file-formats
5+
control: XlsIO
6+
documentation: UG
7+
---
8+
9+
# How to convert xls document to xlsx format document?
10+
11+
The following code illustrates how to convert xls document to xlsx format document.
12+
13+
{% tabs %}
14+
{% highlight c# tabtitle="C# [Cross-platform]" %}
15+
using (ExcelEngine excelEngine = new ExcelEngine())
16+
{
17+
IApplication application = excelEngine.Excel;
18+
application.DefaultVersion = ExcelVersion.Xlsx;
19+
20+
//Loads an xls file
21+
FileStream fileStream = new FileStream("InputTemplate.xls", FileMode.Open, FileAccess.Read);
22+
IWorkbook workbook = application.Workbooks.Open(fileStream);
23+
24+
//Set the workbook version to xlsx
25+
workbook.Version = ExcelVersion.Xlsx;
26+
27+
//Saving the workbook as stream in xlsx format
28+
FileStream stream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite);
29+
workbook.SaveAs(stream);
30+
stream.Dispose();
31+
}
32+
{% endhighlight %}
33+
34+
{% highlight c# tabtitle="C# [Windows-specific]" %}
35+
using (ExcelEngine engine = new ExcelEngine())
36+
{
37+
IApplication application = engine.Excel;
38+
application.DefaultVersion = ExcelVersion.Xlsx;
39+
40+
//Loads an xls file
41+
IWorkbook workbook = application.Workbooks.Open("InputTemplate.xls");
42+
43+
//Set the workbook version to xlsx
44+
workbook.Version = ExcelVersion.Xlsx;
45+
46+
//Saving the workbook in xlsx format
47+
workbook.SaveAs("Output.xlsx");
48+
}
49+
{% endhighlight %}
50+
51+
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
52+
Using engine As ExcelEngine = New ExcelEngine()
53+
Dim application As IApplication = engine.Excel
54+
application.DefaultVersion = ExcelVersion.Xlsx
55+
56+
'Loads an xls file
57+
Dim workbook As IWorkbook = application.Workbooks.Open("InputTemplate.xls")
58+
59+
'Set the workbook version to xlsx
60+
workbook.Version = ExcelVersion.Xlsx;
61+
62+
'Saving the workbook in xlsx format
63+
workbook.SaveAs("Output.xlsx")
64+
End Using
65+
{% endhighlight %}
66+
{% endtabs %}

0 commit comments

Comments
 (0)