{ StringBuilder strBody = new StringBuilder(); string siteURL = "http://localhost/images/BG.jpg"; //Put your Image path strBody.Append("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>"); strBody.Append("<html xmlns:v='urn:schemas-microsoft-com:vml' xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:w='urn:schemas-microsoft-com:office:word' xmlns='http://www.w3.org/TR/REC-html40'>"); strBody.Append("<head>"); strBody.Append("<title>Report</title>"); strBody.Append("<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/><meta name=ProgId content=Word.Document><meta name=Generator content=\"Microsoft Word 11\"><meta name=Originator content=\"Microsoft Word 11\">"); strBody.Append("<!--[if gte mso 9]><xml><w:WordDocument><w:View>Print</w:View></w:WordDocument></xml><![endif]-->"); strBody.Append("<!--[if !mso]><style>v\\:* {behavior:url(#default#VML); position: relative;display:inline-block}</style><![endif]-->"); strBody.Append("<style>"); strBody.Append("@page Section1 {size:8.5in 11.0in;margin:0.8in 0.6in 1in 0.4in; mso-header-margin:.5in; mso-footer-margin:.3in; mso-paper-source:0;mso-title-page:yes;}"); strBody.Append("p.MsoFooter, li.MsoFooter, div.MsoFooter {margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan;font-size:10pt;font-family:Arial;}"); strBody.Append("p.MsoHeader, li.MsoHeader, div.MsoHeader {margin:0in;margin-bottom:.0001pt; mso-pagination:widow-orphan;tab-stops:center 3.0in right 6.0in;}"); strBody.Append("div.Section1{page:Section1;font-size:10pt;font-family:Arial}"); strBody.Append("</style>"); strBody.Append("</head>"); strBody.Append("<body bgcolor=white lang=EN-US style=\"tab-interval:.5in\" background='" + siteURL + "'>"); strBody.Append("<!--[if gte mso 9]><xml><v:background id=\"_x0000_s1025\" o:bwmode=\"white\" o:targetscreensize=\"800,600\"><v:fill o:HRef='" + siteURL + "' o:title=\"BGImage\" type=\"frame\"/></v:background></xml><![endif]-->"); strBody.Append("<div class=Section1>"); strBody.Append("<img src='" + siteURL + "' width='500' height='500'>"); strBody.Append("<br><br><br>ADD BACKGROUNG IMAGE IN WORD FILE USING HTML TEXT"); strBody.Append("</div>"); strBody.Append("</body>"); strBody.Append("</html>"); Response.AppendHeader("Content-Type", "application/msword"); Response.AppendHeader("Content-disposition", "attachment; filename=Report.doc"); Response.Write(strBody); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)