469,908 Members | 2,213 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,908 developers. It's quick & easy.

Issues with double quotes when converting ASPX file (HTML format) to excel spreadsheet

I have a dynamically generates ASPX page with tables and data.
Depending on user selection, the same page can be viewed as a simple
web page (rendered in HTML) or as an excel spreadsheet.

If the user chooses to view the page as an excel sheet, I attach the
following line of code in C# in the Page_Load method.
Response.ContentType = "application/vnd.ms-excel";

All this works fine. But some of cells read nvarchar fields from a
database which may contain double quotes ("). The cells with double
quotes dont have a problem when they are rendered in plain web page
format (HTML)
This is an "example" of the cell contents in HTML format.

But when I choose to render the web page in Excel format as mentioned
above, the cells with the double quotes (") get messed up and render
garbage characters (“) in place of the double quotes (")
This is an “example“ of the cell contents in the Excel
spreadsheet format.

I've no clue as to why this is happening. I tried replacing the double
quotes (") with a single quote (') using the .Replace() method for
strings and that seems to alleviate the problem. But I'm not sure if
this is an acceptable or viable solution for the long term.

Does anyone have an idea why this happen? All comments/suggestions
welcome. Thank you in advance.

Mar 10 '06 #1
1 2475
Addition to above post:
The garbage character are showing up as double quotes in this post. So
much for me trying to explain the problem. Our clients use IE 6.0.
This is what the garbage look like (a^Ece) or something like that.

Mar 10 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by DAVID SCHULMAN | last post: by
8 posts views Thread by Michael B. Trausch | last post: by
3 posts views Thread by toffee | last post: by
6 posts views Thread by =?Utf-8?B?R2Vvcmdl?= | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.