我有以下代码来导出 aspx 页面上显示的 ID 为“UserDetails”的表格。当我将此表导出到MS Excel文件时,可以看到具有绝对路径的图像,但是当我将表导出到MS WORD (.doc)文件时,则看不到相同的图像。
我在网上搜索了很多,但没有任何帮助。
请帮我解决这个问题。
protected void btnExport_Click(object sender, EventArgs e)
{
Response.Clear();
Response.Buffer = true;
//Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
Response.ContentType = "application/vnd.ms-word";
Response.AddHeader("Content-Disposition", "attachment; filename=WORK_ORDER.doc");
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.Charset = "";
EnableViewState = false;
System.IO.StringWriter writer = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter html = new System.Web.UI.HtmlTextWriter(writer);
UserDetails.RenderControl(html);
Response.Write(writer);
Response.End();
}