用.net程序生成word文件后,默认打开的方式为webLayOut的格式,如下图:
但是有的地方需要直接默认打开的时候,是PrintLayOut的模式,如下图:
需要在代码中重新设置一下。下面是全部的代码,关键的地方做了一些注释:
System.IO.StringWriter myTextWriter = new StringWriter();
System.Web.UI.HtmlTextWriter myHtmlTextWriter = new HtmlTextWriter(myTextWriter);
myHtmlTextWriter.Write("blah blah blah");
StringBuilder strBody = new StringBuilder();
#region 设置生成的word,打开模式默认为PrintLayOut,并设置显示大小
strBody.Append("<html ");

