Writing the contents of response object into an ExcelSheet
ASP.NET
1
Posts
1
Posters
0
Views
1
Watching
-
Following is the code that i have written to write contents of response object into an ExcelSheet.
Response.Clear(); Response.Buffer = true; Response.ContentType = "application/vnd.ms-excel"; Response.Charset = ""; string sep = ""; foreach (DataColumn dc in dt.Columns) { Response.Write(sep + dc.ColumnName); sep = "\t"; } Response.Write("\n"); int count; foreach (DataRow drow in dt.Rows) { sep = ""; for (count = 0; count < dt.Columns.Count; count++) { Response.Write(sep + drow[count].ToString()); sep = "\t"; } Response.Write("\n"); }
If less than 30 records are there in the response , its not writting in the excel sheet. Plzzzz help me:( Mads