how to show HTML code in column?
-
16-10-2019 - |
Question
how can i force sharepoint2007 (MOSS) to interpret HTML code instead of showing it?
I have a column which calculates a yes or no (depending on other columns) within a HTML (i want to show images too). This column is not interpreted by sharepoint. HTML is shown in the column plain.
What can i do to solve this?
Solution
Have a look at the solution described in this post: Using calculated columns to write HTML
original post (links are broken)
elcapitano, my tutorial should work:
http://blog.pathtosharepoint.com/2008/09/01/using-calculated-columns-to-write-html/
A couple notes:
- in the above post, you'll find a link to a troubleshooting page
- there are several versions of the Text to HTML script, I recommend that you pick the latest one (v 2.1.1) here: http://sp2010.pathtosharepoint.com/SharePoint-User-Toolkit/Downloads/
If it doesn't work, feel free to share your HTML string (calculated column output) and I'll take a look.
OTHER TIPS
By far the easiest method to do this is to simply set the "data type returned from this formula" setting on your column to be "Number".
Against all logic, this interprets your formula as HTML. I'm not sure if this works in 2007, but it certainly works in 2010 and 2013. Since there are 10,000 views on this topic and very few up votes, I'm guessing this is a much better answer for the wider community than any of the answers given.
We've recently released a free HTML Calculated Column; it acts just like a calculated column, but won't escape HTML:
Pentalogic's SharePoint HTML Calculated Column
Disclaimer: I work for Pentalogic; on this project actually. Oh, and I'm afraid you have to sign up for our newsletter, but that isn't a bad trade (in my unbiased opinion). :)
If you are bound to using a ListView Webpart (OOTB web part), then you can use Christophe's Text2HTML script. Elaborating on James's answer, you can also look at Marc Anderson's DVWPCalcHTMLColumn XSLT to do the heavy lifting.
If you are developing a DataViewWebPart, you can force sharepoint to render the HTML as opposed to displaying the raw text by using disable-output-escaping set to yes.