用repeater控件导出word后,只显示HTML代码
前台:
<table class="usertableborder" cellspacing="1" cellpadding="3" width="96%" align="center" border="0">
<asp:Repeater ID="RepeatUser" runat="server" >
<HeaderTemplate>
<tr>
<th>选择</th>
<th>员工编号</th>
<th>员工名称</th>
<th>合同编号</th>
<th>手机</th>
<th>更新</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td class="usertablerow1"><input type="checkbox" name="chkUserList" id="chkUser" value='<%# Eval("Id") %>' /></td>
<td class="usertablerow1"><%#Eval("ID") %></td>
<td class="usertablerow1"><%#Eval("Name") %></td>
<td class="usertablerow1"><%#Eval("Contract") %></td>
<td class="usertablerow1"><%#Eval("MobilePhone") %></td>
<td class="usertablerow1"><a href=AddUser.aspx?id=<%#Eval("ID") %>>更新</a></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
<font size=2><p align=center><asp:Literal ID="RecordCount" runat="server"></asp:Literal>条记录
共有<asp:Literal ID="PageCount" runat="server"></asp:Literal>页
当前第<asp:Literal ID="Pageindex" runat="server"></asp:Literal>页
<asp:HyperLink ID="FirstPage" runat="server" Text="首页"></asp:HyperLink>
<asp:HyperLink ID="PrevPage" runat="server" Text="上一页"></asp:HyperLink>
<asp:HyperLink ID="NextPage" runat="server" Text="下一页"></asp:HyperLink>
<asp:HyperLink ID="LastPaeg" runat="server" Text="尾页"></asp:HyperLink>
跳转到<asp:Literal ID="Literal1" runat="server"></asp:Literal>页
</p></font>
<table cellspacing="1" cellpadding="3" width="96%" align="center" border="0">
</table>
后台:
#region 导出数据函数
/// <summary>
/// 导出数据函数
/// </summary>
/// <param name="FileType">导出文件MIME类型</param>
/// <param name="FileName">导出文件的名称</param>
private void Export(String FileType, String FileName)
{
Response.Clear();
Response.BufferOutput = true;
//设定输出字符集
Response.Charset = "GB2312";
Response.ContentEncoding = System.Text.Encoding.UTF8;