现有一页面,页面上有文字也有图片,我想将整个页面的内容导入excel中,但我用下面的代码只能导入文字而不能导入图片:
前台:
<table id="table1" runat="server">
<td><asp:Label ID="Lb1" runat="server" Text="excel导入" Width="96px"></asp:Label></td>
<td><img id="Img2" name="img1" src="photo/friend.gif" /></td>
</table>
后台:
Response.Clear();
Response.Buffer = true;
Response.Charset = "GB2312";
Response.AppendHeader("Content-Disposition", "attachment;filename=temp.xls");
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");//设置输出流为简体中文
Response.ContentType = "application/ms-excel";//设置输出文件类型为excel文件。
this.EnableViewState = false;
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN", true);
System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad);
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.table1.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
请问怎样才既能导入文字又能导入图片到excel?
前台:
<table id="table1" runat="server">
<td><asp:Label ID="Lb1" runat="server" Text="excel导入" Width="96px"></asp:Label></td>
<td><img id="Img2" name="img1" src="photo/friend.gif" /></td>
</table>
后台:
Response.Clear();
Response.Buffer = true;
Response.Charset = "GB2312";
Response.AppendHeader("Content-Disposition", "attachment;filename=temp.xls");
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");//设置输出流为简体中文
Response.ContentType = "application/ms-excel";//设置输出文件类型为excel文件。
this.EnableViewState = false;
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN", true);
System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad);
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.table1.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
请问怎样才既能导入文字又能导入图片到excel?
用JS写一个函数 COPY 页面内容 然后 调用EXCEL里面一个粘帖的可以做到。