【发布时间】:2016-12-26 09:25:10
【问题描述】:
我正在将 html 内容(用户键入的内容-段落-hmtl 页面)导出到 MS-word(doc)。当我使用 C# Click 事件将内容导出到 word 时。它的工作正常。但它的内容周围有一些蓝色边框。 enter image description here
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=" + Candidatename + "_" + filename + ".doc");
Response.ContentType = "application/vnd.ms-word";
tb = new Table();
TableRow tr1 = new TableRow();
TableCell cell1 = new TableCell();
tr1.Attributes.Add("style", "border: 0px");
tb.Attributes.Add("style", "border: 0px");
cell1.Attributes.Add("style", "border: 0px");
cell1.Text = Convert.ToString(str);
tr1.Cells.Add(cell1);
tb.Rows.Add(tr1);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
tb.RenderControl(hw);
变量“str”从sql server中获取值(用户在文本区控件中输入的动态数据。
【问题讨论】: