How to Export Datagrid view data to excel in ASP.net 3.5?

Discussion in 'ASP .Net Web Controls' started by chandan, Oct 14, 2008.

  1. chandan

    chandan Guest

    Hi All!
    How to Export Datagrid view data to excel in ASP.net 3.5?

    Thanks,
    Chandan
     
    chandan, Oct 14, 2008
    #1
    1. Advertising

  2. chandan

    Nafly Guest

    I have some code..
    I think it will help you...
    public static void CreateWorkbook(DataSet ds, String path)
    {
    XmlDataDocument xmlDataDoc = new XmlDataDocument(ds);
    XslTransform xt = new XslTransform();
    StreamReader reader =new StreamReader(typeof
    (WorkbookEngine).Assembly.GetManifestResourceStream(typeof (WorkbookEngine),
    "Excel.xsl"));
    XmlTextReader xRdr = new XmlTextReader(reader);
    xt.Load(xRdr, null, null);

    StringWriter sw = new StringWriter();
    xt.Transform(xmlDataDoc, null, sw, null);

    StreamWriter myWriter = new StreamWriter (path + "\\Report.xls");
    myWriter.Write (sw.ToString());
    myWriter.Close ();
    }

    And also visit following websites

    http://www.codeproject.com/KB/grid/exceldatagridview.aspx

    http://www.c-sharpcorner.com/upload...2005041447am/exportaspnetdatagridtoexcel.aspx

    http://www.vbdotnetheaven.com/Uploa...el01092007134204PM/ExportDataGridtoExcel.aspx







    "chandan" <> wrote in message
    news:...
    > Hi All!
    > How to Export Datagrid view data to excel in ASP.net 3.5?
    >
    > Thanks,
    > Chandan
     
    Nafly, Oct 16, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    5,886
  2. =?Utf-8?B?ZGlub28=?=

    Urgent - Asp.NET Datagrid export Excel - landscape Issue

    =?Utf-8?B?ZGlub28=?=, Aug 7, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    2,776
    =?Utf-8?B?ZGlub28=?=
    Aug 7, 2006
  3. Grey
    Replies:
    4
    Views:
    2,041
    Mark Rae [MVP]
    Oct 17, 2007
  4. chandan
    Replies:
    1
    Views:
    1,769
    Cowboy \(Gregory A. Beamer\)
    Oct 14, 2008
  5. Parthiv Joshi
    Replies:
    1
    Views:
    751
    Samuel L Matzen
    Jul 6, 2004
Loading...

Share This Page