Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 20th, 2012  |  syntax: None  |  size: 0.73 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Change Margins on HTML export to Word
  2. Response.Clear();
  3. Response.ClearHeaders();
  4. Response.Buffer = true;
  5. Response.ContentType = "application/msword";
  6. Response.AddHeader("Pragma", "public");
  7. Response.AddHeader("Expires", "0");
  8. Response.AddHeader("Content-Type", "application/word");
  9. Response.AddHeader("content-disposition", String.Format("attachment;filename={0}.doc", docName));
  10. Response.Charset = "utf-8";
  11. StringWriter sw = new StringWriter();
  12. HtmlTextWriter hw = new HtmlTextWriter(sw);
  13. mainbody.RenderControl(hw);
  14. Response.Output.Write(sw.ToString());
  15. Response.Flush();
  16. Response.End();
  17.        
  18. @page WordSection1
  19. {
  20.   size:8.5in 11.0in;
  21.   margin:1.0in 1.0in 1.0in 1.0in;
  22.   mso-header-margin:.5in;
  23.   mso-footer-margin:.5in;
  24.   mso-paper-source:0;
  25. }