tags:

views:

266

answers:

1

I am writing the data to the output browser using Response.write(some byte arrary)

        Response.ContentType = "application/ms-excel";
        Response.ContentEncoding = System.Text.Encoding.Default;
        Response.OutputStream.Write(report, 0, report.Length);
        Response.Flush();
        Response.Close();

In my file I am having ANSI characters I need to write the information in the format ANSI when i open my excel file. Do we need to add anything.

I have encoded it to ANSI but its not working.

+1  A: 

You say you're writing a byte array, but there's no such thing as an "ANSI" byte. A byte is a byte is a byte. You only need ANSI or any other encoding if you're writing strings or chars.

So if your report is a byte[] representing ANSI text, how have you encoded it?

Mike Scott