Wednesday, 26 March 2014

Excel download Number format Issue - Solution

   Response.ContentType = "application/vnd.ms-excel";
                Response.AppendHeader("content-disposition", "attachment; filename=TestFile-"+DateTime.Now.ToFileTime()+".xls");
                string style = @"<style> td { mso-number-format:""0""; } </style> ";// this is used to ensure that the big phone numbers are not converted to exponential values
                Response.Write(style);// apply style
                Response.Write(sw.ToString());
                Response.End();

No comments:

Post a Comment