Convert Excel to OpenDocument Spreadsheet (.ods) format in C#, VB.NET

2016-08-10 03:17:13 Written by  support iceblue
Rate this item
(0 votes)

Simple introduction about OpenDocument Spreadsheet format

The OpenDocument Spreadsheet format (commonly referred to as ODS format) is an XML-based file format for editable spreadsheet documents defined by OASIS. This free ISO-standardized format is now widely supported by a variety of free software applications, such as OpenOffice.org and the LibreOffice suite.

Using C#/VB.NET to convert Excel to .ods format via Spire.XLS

Spire.XLS, a powerful .NET excel component, enables developers to convert excel documents to ods format easily. This part will introduce you the solution of converting excel to .ods format in c# and vb.net.

Now, please view the following screenshot of the original excel document in .xlsx format:

How to Convert Excel to OpenDocument Spreadsheet (.ods) format in C#, VB.NET

Then refer to the following steps:

Step 1: Initialize a new instance of Workbook class and load the excel document from file.

Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");

Step 2: Invoke Workbook.SaveToFile(string fileName, FileFormat fileFormat) method to save the excel document to ODS format.

workbook.SaveToFile("Result.ods",FileFormat.ODS);

Run the project, we will get the following result file in .ods format:

How to Convert Excel to OpenDocument Spreadsheet (.ods) format in C#, VB.NET

Full codes:

[C#]
using Spire.Xls;

namespace Convert_Excel_to_ODS
{
    class Program
    {
        static void Main(string[] args)
        {
            Workbook workbook = new Workbook();
            workbook.LoadFromFile("Sample.xlsx");
            workbook.SaveToFile("Result.ods",FileFormat.ODS);
        }
    }
}
[VB.NET]
Imports Spire.Xls

Namespace Convert_Excel_to_ODS
	Class Program
		Private Shared Sub Main(args As String())
			Dim workbook As New Workbook()
			workbook.LoadFromFile("Sample.xlsx")
			workbook.SaveToFile("Result.ods", FileFormat.ODS)
		End Sub
	End Class
End Namespace=

Additional Info

  • tutorial_title:
Last modified on Monday, 06 September 2021 02:00