View Single Post
  #6   Report Post  
Old October 29th 05, 05:32 PM
John-Raritan
 
Posts: n/a
Default How do I display html code within a cell?

Folks - thanks for the replys, I will check them out.

A little more detail on my problem so you can better relate. I am
populating a spreadsheet using ODBC to a sql server database. Some of the
fields being returned have html commands for formatting - nothing fancy, just
bold, underline, ect. So, ideally, I would like the text to show fully
formated. At the minimum, I would need to remove the html formating so the
text would be readable.

John

"David McRitchie" wrote:

Hi FinRazel,
I didn't know about that PasteSpecial as HTML and it works in Excel 2000.

Hi John-Raritan

But you have to have copied from HTML not from text like
<bHello World</b <font color="red"I'm <bready</b now.</font

and I think you said he had a lot of them, if not problem is solved; otherwise,.

I can't see anything to copy text to the clipboard and have the clipboard
marked up as having HTML code instead of text so it can be
pasted back into the Excel cell..

This thread was as close as I came to something of possible interest.
http://groups.google.com/groups?thre...%40tkmsftngp02

and Chip Pearson's http://www.cpearson.com/excel/clipboar.htm
but it is only for copying formulas or text.

Somehow you have to get the HTML text into the Windows clipboard
as HTML.

Before getting carried away though keep in mind that a cell
can only have one link, and if it has a link you will see it all
as one link.

If it is just a matter of boldface then you could convert the strings
with something else that David Hager showed us - this is for
subscripts.
http://groups.google.com/group/micro...ca9546cafd5127
Gord Dibben had an example boldfacing and/or coloring characters within a cell Oct 2002
http://groups.google.com/groups?thre...oe% 404ax.com


Converting what you have to HTML with my macro might work for you:
One way would be to convert the worksheet to HTML see
http://www.mvps.org/dmcritchie/excel/xl2html.htm
which is a stupid macro and does not recognize most HTML code so it will be
simply transferred. Then copy and paste the generated HTML back to Excel.

You could convert just one column based on your selection then paste the
converted column back to your Excel sheet.

I have no idea if that would be an acceptable solution. But this is the way that
I create most of my tables for my Excel documentation. I just tested it with
your example and (just boldface tags) and it worked fine. Converting only one
column and then copying and pasting back from HTML (using Internet Explorer)
would get you around having to preserve any formulas in the other columns.

BTW, your subject is ambiguous it looks like it means the opposite of what you
are asking for, and I'd have a hard time rephrasing it myself. Perhaps
How to convert HTML formatting tags to format data within Excel
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"FinRazel" wrote ...
How much data are you talking about? Instead of using Import, could you use
copy/paste? If you can, simply Paste Special and click the HTML radio button.

"John-Raritan" wrote:
I am importing data to a cell. The data is actually html code. I would like
to display the data formatted. Right now I get all the ugly html codes, like
<b Hello World</b. .....