Tuesday, 19 July 2011 06:38

Export Excel to XML and Import XML to Excel

Written by  support iceblue
Rate this item
(0 votes)

How can we export Excel to Office Open XML and import Office Open XML to Excel quickly and with sound quality? The answer is what most developers desire to know and clients concern. Here will demonstrate an effortless method to export Excel to Office Open XML and import Office Open XML to Excel separately or synchronously.

Spire.XLS for .NET is a professional .NET Excel component which enables us to fast export Excel to Office Open XML or import Office Open XML to Excel within just three steps. The export/import features such unique as below:

  • Microsoft Excel is not necessary on client and/or server side.
  • Export/import can be proceeding separately or synchronously.

Excel to XML

Spire.Xls for .NET always welcomes any kind of trial or evaluation, so feel free to download Spire.XLS for .NET to realize transform between Excel and Office Open XML within 3 steps.

PS: Spire.Xls only supports Office OpenXML.

Export Excel to Office Open XML in C#, VB.NET

The whole process of exporting Excel to Office Open XML in C#, VB.NET can be described as 3 simple steps:

  • Create a new workbook
  • Load information from excel file and transfer into workbook
  • Save workbook as Office Open XML file format

The following is the code sample that we use to export Excel to Office Open XML in C#, VB.NET

[C#]
using Spire.Xls;
namespace Xls2Xml

{
    class Program
    {
        static void Main(string[] args)
        {
            Workbook workbook = new Workbook();
            workbook.LoadFromFile(@"..\..\test.xls");
            workbook.SaveAsXml("sample.xml");
        }
    }
}
[VB.NET]
Imports Spire.Xls
Namespace Xls2Xml
       Friend Class Program
              Shared Sub Main(ByVal args() As String)
                     Dim workbook As New Workbook()
                     workbook.LoadFromFile("..\..\test.xls")
                     workbook.SaveAsXml("sample.xml")
              End Sub
       End Class
End Namespace

Import Office Open XML to Excel in C#, VB.NET

In this section, you will feel it is as easy as ABC to import Office Open XML to Excel in C#, VB.NET. This process will also be completed in 3 steps too. Please see the codes below:

[C#]
using Spire.Xls;
namespace Xml2Xls

{
    class Program
    {
        static void Main(string[] args)
        {
            Workbook workbook = new Workbook(); 
            workbook.LoadFromFile(@"..\..\test.xml"); 
            workbook.SaveToFile("sample.xls");
        }
    }
}
[VB.NET]
Imports Spire.Xls
Namespace Xml2Xls

	Class Program
		Private Shared Sub Main(args As String())
			Dim workbook As New Workbook()
			workbook.LoadFromFile("..\..\test.xml")
			workbook.SaveToFile("sample.xls")
		End Sub
	End Class
End Namespace

Additional Info

  • tutorial_title: Export Excel to XML and Import XML to Excel
Last modified on Tuesday, 29 July 2014 01:45