Exporting data from a gridview to different excel worksheets
        Posted  
        
            by Alex
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Alex
        
        
        
        Published on 2010-05-10T05:47:49Z
        Indexed on 
            2010/05/10
            5:54 UTC
        
        
        Read the original article
        Hit count: 339
        
I am binding data from a dataset to a grid and exporting data from the grid to an excel.if the the number of items in the grid is greater than 50000,an error message is displayed.
So i want to split the data and display it in different worksheets in excel.(Am working in a web application)
using this code for exporting to excel gvExcel.DataSource = DTS; gvExcel.DataBind(); Response.AddHeader("content-disposition", "attachment; filename= filename.xls"); Response.ContentType = "application/excel"; StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); gvExcel.RenderControl(htw); // Style is added dynamically Response.Write(style); Response.Write(sw.ToString()); Response.End();
Can anyone help me on this??
© Stack Overflow or respective owner