3

私はインターンシップ中のフランス人学生で、HTML テーブルから単語をエクスポートする必要があります。

私は私のものを手に入れTable tableContent = new Table()、エクスポートにこの方法を使用しています:

Response.Clear();
Response.Buffer = true;
Response.Write(@"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0           Transitional//EN"">");
Response.AddHeader("content-disposition", "attachment;filename=DataTable.doc");
Response.ContentType = "application/msword";
String style = "<style>body {margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size:11px;}</style>";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
tableContent.RenderControl(hw);
Response.Charset = "ISO-8859-1";
Response.ContentEncoding = System.Text.Encoding.GetEncoding(1252);
Response.HeaderEncoding = System.Text.Encoding.GetEncoding(1252);
Response.Write(style);
Response.Write(sw.ToString());
Response.Flush();
Response.End();

しかし、ワードファイル (.doc) を読むと、選択されたビューは単語の「Web」であり、"Page"ビューを選択すると、テーブルが中央に配置されず、左余白が大きくなります。

Word 文書を A4 形式に設定し、余白を表の中央に設定できるかどうかを知りたいです。

4

1 に答える 1

-1

テーブルの余白を中央に設定するためのものです

*
    {
        margin:0px;
        padding:0px;

        }
        #all
            {

                width:100%;
                margin:0px;

                }
于 2013-11-14T18:23:04.673 に答える