c# - Image gets broken when exporting a table to word doc in asp.net -
i trying export data inside panel word doc in asp.net 4.0
i able achieve result of exporting whole content word, getting broken image box using in .aspx page.
my .aspx page :
<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>
and code-behind export 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(); }
here word doc screen shot :
any clue how remove broken image or fix ? googled lot not clear of answers.
i run same problem few days ago, instead of :
src="images/aoafund.png"
try mention full url :
src="http://server_host/images/aoafund.png"
i hope helps.
Comments
Post a Comment