|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to export DataTable or DataSet to Excel file?Is this a Winforms app or a Web App? The reason I ask is b/c you can use
Response.Write on the web to export the data in agrid to excel. You have two other choices. Use COMInterop and write the values out yourself or use the OleDbDataAdapter. Show quote "ABC" <a**@abc.com> wrote in message news:uNOgbJlUGHA.5044@TK2MSFTNGP09.phx.gbl... > How to export DataTable or DataSet to Excel file? > > You can even use a normal StreamWriter object. Write to the file with
tab spacing (Excel will pick this up as columns) and just save the file with a XLS extension. Yes,
If you don't need any fancy formatting csv and streamwriter are the ideal combination, here you have a sample about that: http://dotnetspider.com/technology/KBPages/963.aspx However if you need some formatting (some fonts and colors, but no charts), I will use XMLSS (XML + XSL => XMLSS => StreamWriter), sound tricky but Excel generates almos the XSL for you (if you are interested on this choice give me a shout I will try to find the english links about this issue). Good Luck Braulio -- Show quote/// ------------------------------ /// Braulio DÃez Colaborador DNM /// /// http://www.dotnetmania.com /// My Site (.net Tips): http://www.bdiez.com /// ------------------------------ "Hendrik" wrote: > You can even use a normal StreamWriter object. Write to the file with > tab spacing (Excel will pick this up as columns) and just save the file > with a XLS extension. > > Hello
You can use XSL to convert it, a sample project: http://www.dotnetmania.com/Articulos/016/Apoyo/HojasExcel.zip The article is in Spanish: http://www.dotnetmania.com/Articulos/016/index.html About material in English: http://www.eggheadcafe.com/articles/20050404.asp Good Luck Braulio -- Show quote/// ------------------------------ /// Braulio DÃez Colaborador DNM /// /// http://www.dotnetmania.com /// My Site (.net Tips): http://www.bdiez.com /// ------------------------------ "ABC" wrote: > How to export DataTable or DataSet to Excel file? > > >
Other interesting topics
|
|||||||||||||||||||||||