Page 1 of 1

html string in excel

Posted: Mon May 05, 2008 3:29 am
by SmokyBarnable
I have a string that contains html and it is written to a .xls file via a excel writer class. When I open the file with excel the column that contains the html renders in the column...I know nothing about excel but I was expecting to see just the raw string. When I attempt to save the file as a text tab delimited file the html disappears. I want to retain the html. Is there a special way to encode the html string before writing it to a file? Do I need to escape the html somehow?

Thanks.

Re: html string in excel

Posted: Mon May 05, 2008 9:56 pm
by SmokyBarnable
I solved this problem by using htmlentities on my html string before writing it the .xls file. The html text displays properly now, and when saving it to a text file the html remains as it should. I don't really understand why it worked though. Can anyone explain it to me?

Thanks.

Re: html string in excel

Posted: Mon May 05, 2008 10:01 pm
by John Cartwright
Hint: View->source