This question is locked. New answers and comments are not allowed.
Hi Team,
when i try to Export the Grid having 65000 Rows to Excel file i am getting the Error/ IE is Crashing
code i write is as follows
when i try to Export the Grid having 65000 Rows to Excel file i am getting the Error/ IE is Crashing
code i write is as follows
string extension = "xls"; string exportType = "Excel"; SaveFileDialog dialog = new SaveFileDialog() { DefaultExt = extension, Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, exportType), FilterIndex = 1 }; if (dialog.ShowDialog() == true) { using (Stream stream = dialog.OpenFile()) { MemoryStream ms = new MemoryStream(); Pager.PageSize = 0; gridview.Export(ms, new GridViewExportOptions() { Format = ExportFormat.ExcelML, ShowColumnHeaders = true, ShowColumnFooters = false, ShowGroupFooters = false, }); ms.Seek(0, SeekOrigin.Begin); string header = @"<Row ss:AutoFitHeight='0'><Cell ss:MergeAcross='" + (gridview.Columns.Count - 1).ToString() + "' ><Data ss:Type='String'>" + Heading + "</Data></Cell></Row>"; StreamReader sr = new StreamReader(ms); string msStr = sr.ReadToEnd(); msStr = msStr.Insert(msStr.IndexOf("<Row>"), header); msStr = msStr.Replace("R1", "R2"); stream.Write(Encoding.UTF8.GetBytes(msStr), 0, msStr.Length); } Pager.PageSize=30;