1

Hi can any one let me know the code to export the xml file to Excel file.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Anand Kumar M
  • 728
  • 3
  • 12
  • 25
  • What version of Excel? There are lots of different tools available. Also, you said "xml file directly, not using dataset". Can you expand on your requirements a bit? Specifically, what other limitations do you have? – NotMe Mar 15 '11 at 14:29
  • Actually we need to merge some columns under a single column. – Anand Kumar M Mar 17 '11 at 13:28

2 Answers2

2

you can load your xml file to dataset first and then from dataset you can generate excel file. You should get plenty of examples by doing google search for 'xml to dataset in c#' and 'dataset to excel in c#'

Nikhil Vaghela
  • 920
  • 2
  • 11
  • 36
  • Thanks.But I want to export from 'xml' file directly to Excel but not using dataset – Anand Kumar M Mar 15 '11 at 10:51
  • @Anand, Any specific reason you do not want to use Dataset ? Probably you should include more specific requirements/limitations like this in your question itself to get more appropriate answers. – Nikhil Vaghela Mar 17 '11 at 05:33
  • Actually we need to merge some columns under a single column. – Anand Kumar M Mar 17 '11 at 13:26
  • You can still use dataset approach, as once you get your xml in dataset, you can manipulate your Dataset columns and merge those column. Refer the code snippet given in this SO Answer [ http://stackoverflow.com/questions/456568/how-do-i-merge-two-columns-in-a-dataset] – Nikhil Vaghela Mar 21 '11 at 05:09
0

You don't need .NET for that; Excel has can store spreadsheets as XML, so you need to convert your XML into a format that Excel understands.

Those conversions can be done very well using XSLT.

This article gives you a nice introduction on how to do that.

--jeroen

Jeroen Wiert Pluimers
  • 23,965
  • 9
  • 74
  • 154