Friday, 15 July 2011 06:36

How to Convert XML to Word

Written by  support iceblue
Rate this item
(0 votes)

Why Use C#/VB.NET Convert Office OpenXML to Word?

As a great programming language, Office OpenXML is hard to navigate and access when in its natural form. And converting files from Office OpenXML to Word form can help to find and alter parts of code. On the other hand, converting Office OpenXML to Word is helpful in sharing the code with others.

How to Use C#/VB.NET Convert Office OpenXML to Word?

Spire.Doc allows users to convert files from Office OpenXML to Word with C#/VB.NET. Spire.Doc is a MS Word component which enables user to perform a wide range of Word document processing tasks directly for .NET and Silverlight. Like Microsoft Word can help you save Word files to different format, Spire.Doc also support converting files from Word to HTML, PDF, Office OpenXML, RTF, Text, Docx, Dot, etc. Furthermore, besides converting files from Word to other popular file format, Spire.Doc can also transfer files from Office OpenXML to Word, RTF to Word, Text to Word, Dot to Word, etc.

Download Spire.Doc (or Spire.Office) with .NET framework together and use the C#/VB.NET code below to convert Office OpenXML to Word.

[C#]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Spire.Doc;

namespace Xml2Word
{
    class Program
    {
        static void Main(string[] args)
        {
            Document doc = new Document();
            doc.LoadFromFile("sample.xml", FileFormat.Xml);
            doc.SaveToFile("test.doc", FileFormat.Doc);
        }
    }
}
[VB.NET]
Imports System.Text
Imports Spire.Doc

Namespace Xml2Word
	Friend Class Program
		Shared Sub Main(ByVal args() As String)
			Dim doc As New Document()
			doc.LoadFromFile("sample.xml", FileFormat.Xml)
			doc.SaveToFile("test.doc", FileFormat.Doc)
		End Sub
	End Class
End Namespace

Additional Info

  • tutorial_title: Convert XML to Word
Last modified on Monday, 14 July 2014 02:18