I have a problem with my function for exporting .xls file from website asp.net (C#).
It save all <tr>
into one string.
Function work nice, but it doesn't save properly polish chars (Ł, ó, ę - etc).
how can I resolve this ?
Here is my code:
string ExcelExport;
string StringExport;
(..)
protected void lvUsers_ItemDataBound(object sender, ListViewItemEventArgs e)
{
if (e.Item is ListViewDataItem)
{
(..)
StringExport = StringExport + string.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td></tr>", currentUser.name, currentUser.surname, tel, currentUser.email);
}
}
protected void btnDownloadList_Click(object sender, EventArgs e)
{
ExcelExport = "<table><tr><td>Name</td><td>Surname</td><td>Telephone</td><td>E-mail</td></tr><tr><td> </td><td> </td><td> </td><td> </td></tr>" + StringExport + "</table>";
Response.AddHeader("Content-disposition", "attachment; filename=raport.xls");
Response.Charset = "utf-8";
Response.ContentType = "application/ms-excel";
Response.Write(ExcelExport);
Response.End();
}