What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 4806 |  Welcome, Guest!   Register  Login
 Home > Code Snippets > C# > Convert XML to Word with C# ...
Megan00

Convert XML to Word with C#

 Code Snippet posted by: Megan00 | Posted on: 9/17/2012 | Category: C# Codes | Views: 594 | Status: [Member] | Points: 40 | Alert Moderator   


XML to Word can be realized by three lines' of code in this section with C# via a .NET Word component. First, you need to create a new document and then, call two methods in Spire.Doc dll, one is to load an XML from system by calling the method public void LoadFromFile(string fileName, FileFormat fileFormat) , the other is to save this xml file as word by using public void SaveToFile(string fileName, FileFormat fileForma t). Please follow below code to accomplish your xml to word task :

C# for XML to Doc/Docx:

using Spire.Doc;

using Spire.Doc.Documents;

namespace xml_to_word
{
class Program
{
static void Main(string[] args)
{
Document doc = new Document();
doc.LoadFromFile(@"D:\michelle\my file\xml to word.xml", FileFormat.Xml);
doc.SaveToFile("xml to word.doc", FileFormat.Doc);
}
}
}


Never give up! Smile to the world!
http://excelcsharp.blog.com/
Found interesting? Add this to:


>> Write Response - Respond to this post and get points

More codes snippets

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/25/2013 11:50:18 PM