User1535942433 posted
Hi shsu,
Accroding to your description,do you set css in your repeater?You could post your codes to us.It will help us to solve your problems.
Since you don't post your codes,I have created a test. Just like this:
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<table border="1">
<tr>
<td style="width: 100px">
<%#Eval("Id") %>
</td>
<td style="width: 100px">
<%#Eval("num") %>
</td>
<td style="width: 100px">
<%#Eval("total")%>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
<br />
<asp:Button ID="btnExport" runat="server" Text="Export" OnClick="btnExport_Click"/>
Code-behind:
protected void btnExport_Click(object sender, EventArgs e)
{
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=RepeaterExport.xls");
Response.Charset = "";
Response.ContentType = "application/vnd.ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
Repeater1.RenderControl(hw);
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();
}
Best regards,
Yijing Sun