
Untitled
By: a guest on
May 20th, 2012 | syntax:
None | size: 0.73 KB | hits: 10 | expires: Never
Change Margins on HTML export to Word
Response.Clear();
Response.ClearHeaders();
Response.Buffer = true;
Response.ContentType = "application/msword";
Response.AddHeader("Pragma", "public");
Response.AddHeader("Expires", "0");
Response.AddHeader("Content-Type", "application/word");
Response.AddHeader("content-disposition", String.Format("attachment;filename={0}.doc", docName));
Response.Charset = "utf-8";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
mainbody.RenderControl(hw);
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();
@page WordSection1
{
size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;
}