gpt4 book ai didi

c# - 在 asp.net 中将表格导出到 word doc 时图像损坏

转载 作者:太空宇宙 更新时间:2023-11-03 11:05:17 25 4
gpt4 key购买 nike

我正在尝试将面板内的数据导出到 asp.net 4.0 中的 word 文档

我能够实现将整个内容导出到 word 的结果,但是我在 .aspx 页面中使用的框的图像损坏了。

我的 .aspx 页面:

    <asp:Panel ID="tblReport" runat="server">
<div class="boxed1a">
<img class="images4" src="images/AoAFund.png" width="640" height="45" />
<table class="tb3">
<tr>
<td>Leasehold & Functional Programs</td>
<td><asp:TextBox ID="txtLFP" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>N/A</td>
<td><asp:TextBox ID="txtNA" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>Acquis Maint & Renov</td>
<td><asp:TextBox ID="txtAMR" runat="server"></asp:TextBox></td>
</tr>
</table>
</div>
</asp:Panel>

以及我将此面板导出到 word 的代码隐藏:

protected void btnWord_Click(object sender, EventArgs e)
{
Response.ClearContent();
Response.Charset = "";
Response.AppendHeader("content-disposition", "attachment; filename=report.doc");
Response.ContentType = "application/msword";

StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
tblReport.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}

这是单词文档的屏幕截图: enter image description here

任何线索如何删除损坏的图像或修复它?我在谷歌上搜索了很多,但没有找到任何好的答案。

最佳答案

几天前我完全遇到了同样的问题,而不是:

src="images/AoAFund.png" 

尝试提及完整的网址,例如:

 src="http://server_host/images/AoAFund.png"

希望对您有所帮助。

关于c# - 在 asp.net 中将表格导出到 word doc 时图像损坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16113321/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com