By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,071 Members | 1,747 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,071 IT Pros & Developers. It's quick & easy.

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

P: n/a
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)
Sample:
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 (")
Sample"
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.