Response.Clear();
            HttpContext.Current.Response.Charset = "gb2312";
            HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=custom.doc");
            HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
            System.IO.StringWriter tw = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
            HttpContext.Current.Response.Write(table);
            HttpContext.Current.Response.End();
            tw.Close();现在用的这种方法输出,传说有PageSetup方法?该怎么弄?

解决方案 »

  1.   

    MIME-Version: 1.0
    Content-Location: file:///C:/EC2C4D01/a.htm
    Content-Transfer-Encoding: quoted-printable
    Content-Type: text/html; charset="us-ascii"<html xmlns:v=3D"urn:schemas-microsoft-com:vml"
    xmlns:o=3D"urn:schemas-microsoft-com:office:office"
    xmlns:w=3D"urn:schemas-microsoft-com:office:word"
    xmlns=3D"http://www.w3.org/TR/REC-html40"><head>
    <meta http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii">
    <meta name=3DProgId content=3DWord.Document>
    <meta name=3DGenerator content=3D"Microsoft Word 11">
    <meta name=3DOriginator content=3D"Microsoft Word 11">
    <link rel=3DFile-List href=3D"a.files/filelist.xml">
    <title>a</title>
    <!--[if gte mso 9]><xml>
     <o:DocumentProperties>
      <o:Author>ZF</o:Author>
      <o:LastAuthor>ZF</o:LastAuthor>
      <o:Revision>2</o:Revision>
      <o:TotalTime>0</o:TotalTime>
      <o:Created>2009-07-20T08:43:00Z</o:Created>
      <o:LastSaved>2009-07-20T08:43:00Z</o:LastSaved>
      <o:Pages>1</o:Pages>
      <o:Characters>1</o:Characters>
      <o:Company> </o:Company>
      <o:Lines>1</o:Lines>
      <o:Paragraphs>1</o:Paragraphs>
      <o:CharactersWithSpaces>1</o:CharactersWithSpaces>
      <o:Version>11.6360</o:Version>
     </o:DocumentProperties>
    </xml><![endif]--><!--[if gte mso 9]><xml>
     <w:WordDocument>
      <w:PunctuationKerning/>
      <w:DrawingGridVerticalSpacing>7.8 &#30917;</w:DrawingGridVerticalSpacing>
      <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEve=
    ry>
      <w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery>
      <w:ValidateAgainstSchemas/>
      <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
      <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
      <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
      <w:Compatibility>
       <w:SpaceForUL/>
       <w:BalanceSingleByteDoubleByteWidth/>
       <w:DoNotLeaveBackslashAlone/>
       <w:ULTrailSpace/>
       <w:DoNotExpandShiftReturn/>
       <w:AdjustLineHeightInTable/>
       <w:BreakWrappedTables/>
       <w:SnapToGridInCell/>
       <w:WrapTextWithPunct/>
       <w:UseAsianBreakRules/>
       <w:DontGrowAutofit/>
       <w:UseFELayout/>
      </w:Compatibility>
      <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
     </w:WordDocument>
    </xml><![endif]--><!--[if gte mso 9]><xml>
     <w:LatentStyles DefLockedState=3D"false" LatentStyleCount=3D"156">
     </w:LatentStyles>
    </xml><![endif]-->
    <style>
    <!--
     /* Font Definitions */
     @font-face
    {font-family:SimSun;
    panose-1:2 1 6 0 3 1 1 1 1 1;
    mso-font-alt:SimSun;
    mso-font-charset:134;
    mso-generic-font-family:auto;
    mso-font-pitch:variable;
    mso-font-signature:3 135135232 16 0 262145 0;}
    @font-face
    {font-family:SimSun;
    panose-1:2 1 6 0 3 1 1 1 1 1;
    mso-font-charset:134;
    mso-generic-font-family:auto;
    mso-font-pitch:variable;
    mso-font-signature:3 135135232 16 0 262145 0;}
     /* Style Definitions */
     p.MsoNormal, li.MsoNormal, div.MsoNormal
    {mso-style-parent:"";
    margin:0cm;
    margin-bottom:.0001pt;
    text-align:justify;
    text-justify:inter-ideograph;
    mso-pagination:none;
    font-size:10.5pt;
    mso-bidi-font-size:12.0pt;
    font-family:"Times New Roman";
    mso-fareast-font-family:SimSun;
    mso-font-kerning:1.0pt;}
     /* Page Definitions */
     @page
    {mso-page-border-surround-header:no;
    mso-page-border-surround-footer:no;}
    @page Section1
    {size:841.9pt 595.3pt;
    mso-page-orientation:landscape;
    margin:89.85pt 72.0pt 89.85pt 72.0pt;
    mso-header-margin:42.55pt;
    mso-footer-margin:49.6pt;
    mso-paper-source:0;
    layout-grid:15.6pt;}
    div.Section1
    {page:Section1;}
    -->
    </style>
    <!--[if gte mso 10]>
    <style>
     /* Style Definitions */
     table.MsoNormalTable
    {mso-style-name:\666E\901A\8868\683C;
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin:0cm;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:"Times New Roman";
    mso-ansi-language:#0400;
    mso-fareast-language:#0400;
    mso-bidi-language:#0400;}
    </style>
    <![endif]--><!--[if gte mso 9]><xml>
     <o:shapedefaults v:ext=3D"edit" spidmax=3D"2050"/>
    </xml><![endif]--><!--[if gte mso 9]><xml>
     <o:shapelayout v:ext=3D"edit">
      <o:idmap v:ext=3D"edit" data=3D"1"/>
     </o:shapelayout></xml><![endif]-->
    </head><body lang=3DZH-CN style=3D'tab-interval:21.0pt;text-justify-trim:punctuati=
    on'><div class=3DSection1 style=3D'layout-grid:15.6pt'><p class=3DMsoNormal><span lang=3DEN-US>a</span></p></div></body></html>
      

  2.   

    我想你是在做打印吧?
    如果是的话,我给你段代码。希望对你有用如果有用的话,
    你多给我点分啊!
    http://www.cnblogs.com/erqie/archive/2008/03/20/1114156.html
    这个对你一定有帮助的!!看看吧!
      

  3.   

    再给简化一下:MIME-Version: 1.0
    Content-Transfer-Encoding: quoted-printable
    Content-Type: text/html; charset="us-ascii"
    <html>
    <head>
    <title>a</title><style>
    <!--
     /* Page Definitions */
     @page
    {mso-page-border-surround-header:no;
    mso-page-border-surround-footer:no;}
    @page Section1
    {size:841.9pt 595.3pt;
    mso-page-orientation:landscape;
    margin:89.85pt 72.0pt 89.85pt 72.0pt;
    mso-header-margin:42.55pt;
    mso-footer-margin:49.6pt;
    mso-paper-source:0;
    layout-grid:15.6pt;}
    div.Section1
    {page:Section1;}
    -->
    </style></head><body ><div class=3DSection1 >这是内容。</div></body></html>