Home All Groups Group Topic Archive Search About

How to export DataTable or DataSet to Excel file?

Author
28 Mar 2006 10:28 AM
ABC
How to export DataTable or DataSet to Excel file?

Author
28 Mar 2006 2:02 PM
W.G. Ryan - MVP
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?
>
>
Author
29 Mar 2006 6:12 AM
Hendrik
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.
Author
29 Mar 2006 7:21 AM
Braulio Diez
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


--
/// ------------------------------
/// Braulio Díez   Colaborador DNM
///
/// http://www.dotnetmania.com
/// My Site (.net Tips): http://www.bdiez.com
/// ------------------------------




Show quote
"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.
>
>
Author
28 Mar 2006 5:16 PM
Braulio Diez
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
--
/// ------------------------------
/// Braulio Díez   Colaborador DNM
///
/// http://www.dotnetmania.com
/// My Site (.net Tips): http://www.bdiez.com
/// ------------------------------




Show quote
"ABC" wrote:

> How to export DataTable or DataSet to Excel file?
>
>
>

AddThis Social Bookmark Button