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 OpenXML and import Office OpenXML 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 OpenXML and import Office OpenXML to Excel separately or synchronously.

 

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

 

1, Microsoft Excel is not necessary on client and/or server side.

2, 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 OpenXML within 3 steps.

PS: Spire.Xls only supports Office OpenXML.

1, Export Excel to Office OpenXML in C#, VB.NET

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

1.Create a new workbook

2.Load information from excel file and transfer into workbook

3.Save workbook as Office OpenXML file format

The following is the code sample that we use to export Excel to Office OpenXML 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

2, Import Office OpenXML to Excel in C#, VB.NET

In this section, you will feel it is as easy as ABC to import Office OpenXML 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, 07 January 2014 09:42