From 7c91f54c0dc3b74825b537381f0c39cf3afeba3d Mon Sep 17 00:00:00 2001 From: KurmithaSF4004 Date: Mon, 29 Apr 2024 15:40:03 +0530 Subject: [PATCH 1/3] 882003-Xls-to-Xlsx --- File-Formats-toc.html | 1 + File-Formats/XlsIO/FAQ.md | 3 +- ...rt-xls-document-to-xlsx-format-document.md | 57 +++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 File-Formats/XlsIO/faqs/how-to-convert-xls-document-to-xlsx-format-document.md diff --git a/File-Formats-toc.html b/File-Formats-toc.html index f2a8476db..567b2a4d0 100644 --- a/File-Formats-toc.html +++ b/File-Formats-toc.html @@ -1689,6 +1689,7 @@
  • How to set Logarithmic axis for chart in Excel document?
  • How to resolve performance issue when deleting a large number of rows?
  • How to hide columns using column name?
  • +
  • How to convert xls document to xlsx format document?
  • diff --git a/File-Formats/XlsIO/FAQ.md b/File-Formats/XlsIO/FAQ.md index 480f40187..64ad1a874 100644 --- a/File-Formats/XlsIO/FAQ.md +++ b/File-Formats/XlsIO/FAQ.md @@ -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) \ No newline at end of file +* [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) \ No newline at end of file diff --git a/File-Formats/XlsIO/faqs/how-to-convert-xls-document-to-xlsx-format-document.md b/File-Formats/XlsIO/faqs/how-to-convert-xls-document-to-xlsx-format-document.md new file mode 100644 index 000000000..c151fee43 --- /dev/null +++ b/File-Formats/XlsIO/faqs/how-to-convert-xls-document-to-xlsx-format-document.md @@ -0,0 +1,57 @@ +--- +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.xlsx", FileMode.Open, FileAccess.Read); + IWorkbook workbook = application.Workbooks.Open(fileStream); + + //Saving the workbook as stream in xlsx format + FileStream stream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite); + workbook.SaveAs(stream); + 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"); + + //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") + + ' Saving the workbook in xlsx format + workbook.SaveAs("Output.xlsx") +End Using +{% endhighlight %} +{% endtabs %} \ No newline at end of file From ed854f6c76247786679797548f5dc046bee45575 Mon Sep 17 00:00:00 2001 From: KurmithaSF4004 Date: Mon, 6 May 2024 20:20:53 +0530 Subject: [PATCH 2/3] 882003-Xls-to-Xlsx --- ...-convert-xls-document-to-xlsx-format-document.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/File-Formats/XlsIO/faqs/how-to-convert-xls-document-to-xlsx-format-document.md b/File-Formats/XlsIO/faqs/how-to-convert-xls-document-to-xlsx-format-document.md index c151fee43..4b24e99f1 100644 --- a/File-Formats/XlsIO/faqs/how-to-convert-xls-document-to-xlsx-format-document.md +++ b/File-Formats/XlsIO/faqs/how-to-convert-xls-document-to-xlsx-format-document.md @@ -20,6 +20,9 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Loads an xls file FileStream fileStream = new FileStream("InputTemplate.xlsx", 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); @@ -37,6 +40,9 @@ using (ExcelEngine engine = new ExcelEngine()) //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"); } @@ -47,10 +53,13 @@ Using engine As ExcelEngine = New ExcelEngine() Dim application As IApplication = engine.Excel application.DefaultVersion = ExcelVersion.Xlsx - ' Loads an xls file + 'Loads an xls file Dim workbook As IWorkbook = application.Workbooks.Open("InputTemplate.xls") - ' Saving the workbook in xlsx format + 'Set the workbook version to xlsx + workbook.Version = ExcelVersion.Xlsx; + + 'Saving the workbook in xlsx format workbook.SaveAs("Output.xlsx") End Using {% endhighlight %} From 5b87e3256daaa8ba0a5dae3949a08593743adca8 Mon Sep 17 00:00:00 2001 From: KurmithaSF4004 Date: Tue, 7 May 2024 11:42:48 +0530 Subject: [PATCH 3/3] 882003-Xls-to-Xlsx --- .../faqs/how-to-convert-xls-document-to-xlsx-format-document.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/File-Formats/XlsIO/faqs/how-to-convert-xls-document-to-xlsx-format-document.md b/File-Formats/XlsIO/faqs/how-to-convert-xls-document-to-xlsx-format-document.md index 4b24e99f1..9df421c19 100644 --- a/File-Formats/XlsIO/faqs/how-to-convert-xls-document-to-xlsx-format-document.md +++ b/File-Formats/XlsIO/faqs/how-to-convert-xls-document-to-xlsx-format-document.md @@ -18,7 +18,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) application.DefaultVersion = ExcelVersion.Xlsx; //Loads an xls file - FileStream fileStream = new FileStream("InputTemplate.xlsx", FileMode.Open, FileAccess.Read); + FileStream fileStream = new FileStream("InputTemplate.xls", FileMode.Open, FileAccess.Read); IWorkbook workbook = application.Workbooks.Open(fileStream); //Set the workbook version to xlsx