Dataset to Excel

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

Hi

I would like to export a dataset to xml, but not simply writing the XML
equivalent of the dataset. so perhaps call it the true excel file. by
writing the XML equivalent, excel is able to read the file, but not like
proper excel files

Thanks
Jason
 
Jason,

In order to do this, you are going to have to add a reference to the
Microsoft Excel Object library and the Microsoft Office Library (found under
the "COM" tab when you add a reference to your project). Once you have
those, you can create a new instance of your worksheet and then populate the
worksheet from your dataset as you wish, populating each cell with the
appropriate values.

Another option would be to get the dataset as an XML document, then
apply an XSLT on the document so that it conforms to the XML Spreadsheet
specification. The spreadsheet will still be in XML, but its not like XML
imported into a spreadsheet, but rather, the spreadsheet itself is
constructed from the XML.

Hope this helps.
 
Yes it does!

Thanks
Jason

Nicholas Paldino said:
Jason,

In order to do this, you are going to have to add a reference to the
Microsoft Excel Object library and the Microsoft Office Library (found under
the "COM" tab when you add a reference to your project). Once you have
those, you can create a new instance of your worksheet and then populate the
worksheet from your dataset as you wish, populating each cell with the
appropriate values.

Another option would be to get the dataset as an XML document, then
apply an XSLT on the document so that it conforms to the XML Spreadsheet
specification. The spreadsheet will still be in XML, but its not like XML
imported into a spreadsheet, but rather, the spreadsheet itself is
constructed from the XML.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Jason said:
Hi

I would like to export a dataset to xml, but not simply writing the XML
equivalent of the dataset. so perhaps call it the true excel file. by
writing the XML equivalent, excel is able to read the file, but not like
proper excel files

Thanks
Jason
 
Back
Top