【发布时间】:2013-08-10 00:16:18
【问题描述】:
我是一名实习的法国学生,我需要从 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();
但是当我阅读我的 wordfile (.doc) 时,选择的视图是 word 中的“Web”,当我选择 "Page" 视图时,我的表格没有居中导致巨大的左边距。
我想知道是否可以将我的 word 文档设置为 A4 格式并将边距设置为表格居中。
【问题讨论】:
标签: html ms-word format export margin