M
mutta
I am developping an asp.net application and I have to export some data
from a dataset to word and excel file. The language of this data is
bulgarian. For excel I use a datagrid, and after I databind this
datagrid i use HtmlTextWriter to make it html and I give
"ContentType=application/vnd.ms-excel" to this page to start a client
instance of excel and load data:
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "utf-8";
Response.ContentEncoding = System.Text.Encoding.Unicode;
this.EnableViewState = false;
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter( sw );
dgFilter.RenderControl( hw );
Response.Write( sw.ToString() );
Response.End();
When I have in the datagrid more than 2 rows there's no problem, but
if I have one or two rows the bulgarian is fucked. So I can't
understand where the problem is. I give Response.ContentEncoding =
System.Text.Encoding.Unicode;
or
Response.ContentEncoding = System.Text.Encoding.UTF8;
and whatever else but the problem exists because
Response.ContentEncoding doesn't effect
I change the charset but it doesn't help too.
I put some strange chars in the beginning of Response.Write method to
make excel understand that these are unicode chars but this doesn't
effect too.
So if somebody has idea how to fix this problem I would be thankful!
from a dataset to word and excel file. The language of this data is
bulgarian. For excel I use a datagrid, and after I databind this
datagrid i use HtmlTextWriter to make it html and I give
"ContentType=application/vnd.ms-excel" to this page to start a client
instance of excel and load data:
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "utf-8";
Response.ContentEncoding = System.Text.Encoding.Unicode;
this.EnableViewState = false;
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter( sw );
dgFilter.RenderControl( hw );
Response.Write( sw.ToString() );
Response.End();
When I have in the datagrid more than 2 rows there's no problem, but
if I have one or two rows the bulgarian is fucked. So I can't
understand where the problem is. I give Response.ContentEncoding =
System.Text.Encoding.Unicode;
or
Response.ContentEncoding = System.Text.Encoding.UTF8;
and whatever else but the problem exists because
Response.ContentEncoding doesn't effect
I change the charset but it doesn't help too.
I put some strange chars in the beginning of Response.Write method to
make excel understand that these are unicode chars but this doesn't
effect too.
So if somebody has idea how to fix this problem I would be thankful!