Posted on: 6/14/2012 11:55:43 AM | Views : 325

Hi to all! I have made a code that converts from a DataTable to Excel, formatting the cells to Text so the Leading Zeros are not truncated. If I put the code as a Function in my code it works but if I put the same code as a Class it exports the data to excel but the cells are not in text format so the Leading zeros are Truncated. What Im I doing wrong?
protected void ExportDatatoExcel() { //try //{ string sFileName = "PivotGrid"; DataTable dtToExcel = (DataTable)Session["dsReport"]; //Excel_Export.Export_To_Excel myExcelData = new Excel_Export.Export_To_Excel(); //myExcelData.ExportToExcel(sFileName, ref dtToExcel); /////////////////////////////////////////////////// HttpResponse response = HttpContext.Current.Response; response.Clear(); response.Charset = ""; response.ContentType = "application/vnd.ms-excel"; response.AddHeader("Content- ...

Go to the complete details ...