Actual export is not a problem:
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();
So my question is: how to change the fields on the resulting doc?
If I open the loaded word doc, then save it as HTML, the directive defining the fields will be as follows:
@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; }
I am wondering how I can change this in the response headers so that I can correctly display the form on one sheet. Any ideas?
Tomo
source share