Ravendra's Blog

October 29, 2009

How to convert XML Data into Excel

Filed under: Uncategorized — Ravendra Mishra @ 12:31 pm

using System;
using System.Data;
using System.IO;
using System.Xml;
using System.Xml.Xsl;
namespace XML2Excel
    class Program
        static void Main(string[] args)
            if (args.Length < 2)
                throw new Exception(“Usage: XML2Excel XMLFileName XSLName ExcelFileNameToCreate”);       

            DataSet ds = new DataSet();
            XmlDataDocument xdd = new XmlDataDocument(ds);
            XslTransform xt = new XslTransform();

            StreamWriter swriter = new StreamWriter(args[2]);
            xt.Transform(xdd, null, swriter.BaseStream);           


Hello world!

Filed under: Uncategorized — Ravendra Mishra @ 10:27 am

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

Create a free website or blog at WordPress.com.