Hi,

I'm dealing with an issue most probably related to the encoding. We are using function which export data from a grid into excel. And it uses windows 1250 encoding because of "č,š,ž". Only when we have the large number of records to export, a sign "č" is shown as "è".

This is the function:

HttpContext.Current.Response.Clear();

HttpContext.Current.Response.AddHeader(
"content-disposition", string.Format("attachment; filename={0}", fileName));
HttpContext.Current.Response.ContentType = "application/ms-excel";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.
GetEncoding("windows-1250");


using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter htw = new HtmlTextWriter(sw))
{
// Create a table to contain the grid
Table table = new Table();

// include the gridline settings
table.GridLines = gv.GridLines;

// add the header row to the table
if (gv.HeaderRow != null)
{
GridViewExportUtil.PrepareControlForExport(gv.HeaderRow);
table.Rows.Add(gv.HeaderRow);
}

// add each of the data rows to the table
foreach (GridViewRow row in gv.Rows)
{
GridViewExportUtil.PrepareControlForExport(row);
table.Rows.Add(row);
}

// add the footer row to the table
if (gv.FooterRow != null)
{
GridViewExportUtil.PrepareControlForExport(gv.FooterRow);
table.Rows.Add(gv.FooterRow);
}

// render the table into the htmlwriter
table.RenderControl(htw);



HttpContext.Current.Response.Output.Write(sw.ToString());

HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
}

The string we are sending to write shows all signs correctly.

Thanks in advance!