Friday, March 6, 2009

Exporting Euro symbol in excel from

I was working with exporting GridView to Excel. GridView contains one column that has currency symbols. After exporting to excel all currency were displaying correctly but Euro() symbols got converted to something other characters like this "€" . After searching on internet i got solution. below is the solution.

public void ExportExcel(string filename, GridView gv)
Response.AddHeader("content-disposition", "attachment; filename=" + filename + ".xls");
Response.ContentType = "application/";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
string output = sw.ToString();
byte[] euroByte = new byte[1];
euroByte[0] = (byte)128;
bool isAfterFirst = false;
foreach (string item in output.Split('€'))
if (isAfterFirst)
Response.OutputStream.Write(euroByte, 0, 1);
isAfterFirst = true;


Anonymous said...

Thank you very much: I also had your problem, i tryed your solution and it works excellently!

Anonymous said...


When ever I surf on web I never forget to visit this website[url=].[/url]Plenty of useful information on Do you pay attention towards your health?. Here is a fact for you. Recent Research presents that nearly 60% of all United States grownups are either obese or weighty[url=].[/url] Therefore if you're one of these citizens, you're not alone. In fact, most of us need to lose a few pounds once in a while to get sexy and perfect six pack abs. Now the question is how you are planning to have quick weight loss? [url=]Quick weight loss[/url] is really not as tough as you think. You need to improve some of you daily habbits to achive weight loss in short span of time.

About me: I am webmaster of [url=]Quick weight loss tips[/url]. I am also mentor who can help you lose weight quickly. If you do not want to go under painful training program than you may also try [url=]Acai Berry[/url] or [url=]Colon Cleansing[/url] for fast weight loss.

大人の出会い said...


Hugo said...

That's the exact solution for my problem!!

Thank you a lot!

Amy Carry said...

turn the handle: Good Shower faucet handle in the rotation, there is no switch over between the Pull down kitchen faucet and the gap opened and closed easily unrestricted, non-skid. Not only can poor quality Bathroom accessories gap, blocked feeling too great.

Xin Chen said...

Custom Made Gemstones Rings,Jewelry in Myraygem.