Response.AddHeader("content-disposition", "attachment;filename=" & FileName & "") Response.Charset = "" Response.Cache.SetCacheability(HttpCacheability.NoCache) Response.ContentType = "application/msword" Dim ioWriter As New System.IO.StringWriter() Dim htmlWriter As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(ioWriter) <pre lang="msil">Dim strDocBody As String strDocBody = "<html " + "xmlns:o='urn:schemas-microsoft-com:office:office' " + "xmlns:w='urn:schemas-microsoft-com:office:word'" + "xmlns='http://www.w3.org/TR/REC-html40'>" + "<head>" + "<title>Dynamic Generated Document</title>" strDocBody = strDocBody + "<!--[if gte mso 9]>" + "<xml>" + "<w:WordDocument>" + "<w:View>Print</w:View>" + "<w:Zoom>100</w:Zoom>" + "<w:DoNotOptimizeForBrowser/>" + "</w:WordDocument>" + "</xml>" + "<![endif]-->" strDocBody = strDocBody + "<style> @page" + "{size:8.5in 11.0in; mso-first-footer:ff1; mso-footer: f1; mso-header: h1; padding:24.0pt 24.0pt 24.0pt 24.0pt;" + " margin:0.75in 0.75in 0.5in 1in ; " + " mso-header-margin:.5in; " + " mso-footer-margin:.5in; mso-paper-source:0; mso-header:url('" + strheaderfooterpath + "') h1; mso-footer:url('" + strheaderfooterpath + "') f1;}" + " div.Section1" + " {page:Section1;}" + "p.MsoFooter, li.MsoFooter, div.MsoFooter{margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; tab-stops:center 3.0in right 6.0in; font-size:12.0pt; font-family:'Arial';}" + "p.MsoHeader, li.MsoHeader, div.MsoHeader {margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; tab-stops:center 3.0in right 6.0in; font-size:12.0pt; font-family:'Verdana';}" + "-->" + "</style>" + "</head>" 'strBody.Append("<body lang=EN-US style='tab-interval:.5in'>" & _ ' "<div class=Section1>") strDocBody = strDocBody + "<body lang=EN-US style='tab-interval:.5in'>" + "<div class=Section1>" + "" + "" + "" + "" + "" + "" + "<!--[if supportFields]>" + "<div style='mso-element:header' id=h1><p class=MsoHeader></p></div>" + "<div style='mso-element:footer' id=f1> " + "<p class=MsoFooter style='border:none;padding:0in;mso-padding-alt:0in 0in 1.0pt 0in'><o:p> </o:p></p> " + " " + " " + " </p></div><![endif]-->" + "</div>" strMessage.AppendLine(strDocBody) strMessage.AppendLine("<form >") . . . strMessage.AppendLine("</form>") <pre lang="vb">strMessage.AppendLine("</body>") strMessage.AppendLine("</html>") htmlWriter.Write(strMessage.ToString()) Response.Write(ioWriter.ToString()) Response.[End]()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)