我制作了一个gridview,它将显示一个数据列表,以便能够编辑和导出到word
i datalist包含文本框。我能够导出到单词,但它的布局包含文本框,文本无法查看,需要滚动,因为它嵌入在文本框中
protected void Button3_Click(object sender, EventArgs e)
{
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename-WordDoc.doc");
Response.Charset = "";
Response.ContentType = "application/vnd.ms-word";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTxtWriter(sw);
DataList1.DataBind();
DataList1.RenderControl(hw);
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();
}