猿问

.net 将页面内容导出到word,图片无法显示问题!

Response.ContentType = "application/ms-word";
        Response.AddHeader("Content-Disposition", "inline;filename=EmergencyPlan" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc");
        StringBuilder sb = new StringBuilder();
        System.IO.StringWriter sw = new System.IO.StringWriter(sb);
        System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw);
        sb.Append(" <html> <body runat='server'>");
        lblContent.RenderControl(hw);
        myGridViewYJQXD.RenderControl(hw);
        myGridViewZHBAN.RenderControl(hw);
        //输出图片
        imgList.RenderControl(hw);
        //
        myGridViewTXQC.RenderControl(hw);
        myGridViewYJCL.RenderControl(hw);
        myGridViewYJK.RenderControl(hw);
        sb.Append(" </body> </html>");
        Response.Write(sb.ToString());
        Response.End();
我用 上述方法将。net 页面中指定的控件内容导入到word中,但保存到本地后,图片无法显示,有什么解决办法吗,谢谢。急!

慕无忌1623718
浏览 528回答 1
1回答

慕婉清6462132

把图片地址替换成绝对地址
随时随地看视频慕课网APP
我要回答