How to change header text to bold while downloadingexcel sheet
hi all i have done one task like excel sheet downloading its working but no header is bold below is my code how to change it plz help methsi is my controller
public void ExportClientsListToCSV()
{
StringWriter sw = new StringWriter();
sw.WriteLine("\"User Name\",\"In Time\",\"Out Time\",\"Client Info\",\"User Role\",\"Activity\"");
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment;filename=User_Track.csv");
Response.ContentType = "text/csv";
var abc = TempData["test"];
IEnumerable<PAN_LOGINTRK> test = abc as IEnumerable<PAN_LOGINTRK>;
//object test = (abc);
foreach (var line in test)
{
var role = "";
if (line.userrole == 1)
{
role = "CSAdmin";
}
else if (line.userrole == 2)
{
role = "Buyer";
}
else if (line.userrole == 3)
{
role = "Supervisor";
}
else if (line.userrole == 4)
{
role = "OrgAdmin";
}
sw.WriteLine(string.Format("\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\"",
line.username,
line.Intime,
line.Outtime,
"Client IP: "+line.ClientIP+" Client XIP: "+line.ClientXIP+" Client Agent: "+line.ClinetAgent,
role,
line.Activity));
}
Response.Write(sw.ToString());
Response.End();
}
in view i have written like
function Export() {
var ExportAction = '@Url.RouteUrl("Default", new RouteValueDictionary(new { action = "ExportClientsListToCSV", controller = "UserTrack" }), "http", ConfigurationManager.AppSettings["ContextPath"])'
location.href = ExportAction;
}