Can someone teach me how to convert XML to Excel?

May 27 2005 5:12 AM
Hi people, I hope I am posting in the correct forum. I am trying to develop a Windows application using Visual Studio 2005 C#. What I wish to do is to open a XML file, display it onto the GUI, let the user select which fields they want and export the selected fields to an Excel file. Here are the problems I am facing, 1. When I read the XML file into a dataset using the method 'XMLRead' , it creates 6 tables and 5 relationships in the dataset. But Visual Studio 2005 only has DataGridView and NO DataGrid component. DataGridView can only display 1 table at a time. I do not want to manually add many DataGridView components because the number of tables in the XML file is not fixed. I tried merging the 6 tables into 1 but have been unsuccesful so far. I think it is too difficult or maybe I am just on the wrong track. I first try to identify the root table from the relationships in the dataset, then I tried using loops to combine all the data. It got sooooo complicated I gave up. I also found out that Excel version 2002 and above can open XML files nicely. Thats exactly what I want to do as I am creating this application for people with older versions like Excel 2000. I have been searching the net for a few days for solution but with no results. I hope some of you are are willing to give me some suggestions on how to go about finishing my task. Thanks, Kelvin