Code:
HttpContext.Response.Clear(); HttpContext.Response.ClearContent(); HttpContext.Response.ClearHeaders(); HttpContext.Response.Buffer = true; HttpContext.Response.ContentType = "application/ms-excel"; HttpContext.Response.Write(@"<!DOCTYPE HTML PUBLIC " "-//W3C//DTD HTML 4.0 Transitional//EN"">"); //Set the name of report as per query fired by the user. HttpContext.Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName); HttpContext.Response.Charset = "utf-8"; HttpContext.Response.ContentEncoding = System.Text.Encoding.GetEncoding("windows-1250"); HttpContext.Response.Write("<TR style='font-size:12.0pt; text-align:center; font-style:italic; text-decoration:underline; font-weight:bold;font-family:Book Antiqua;'>"); string s = Server.MapPath("~\\Content\\Images\\abcd.jpg"); string filePath = System.Configuration.ConfigurationManager.AppSettings["LogoPath"]; string imagepath = string.Format("<img src='{0}'/>", s); HttpContext.Response.Write("<Td>"); HttpContext.Response.Write(imagepath); HttpContext.Response.Write("</Td>"); HttpContext.Response.Write("</TR>");
No comments:
Post a Comment