I have updated the TextToHTML script to add support for preview panes. You can get the new version (v 2.1) on the download page.
SharePoint uses a function called “showpreview1″ to render preview panes. My script appends the “text to HTML” transformation to this default function.
Note that since version 2.0, you don’t need DIV tags anymore in your HTML formulas. The script will identify any HTML string, with upper case tags (DIV, SPAN, IMG, A, etc.) or lower case (div, span, img, a, etc.). For this, the script relies on regular expressions, like this one used for list views:
RegExp("^\\s*<([a-zA-Z]*)(.|\\s)*/\\1?>\\s*$")
If you haven’t heard about the HTML Calculated Column yet, check out these links:
- the method, explained (includes version 1.0 of the script)
- an example: apply color coding to lists
- a formula generator for color coding
- a troubleshooting page
…Or read the whole series (~30 posts).

11 comments
Comments feed for this article
July 9, 2009 at 2:43 pm
2009-07-09 Today's Quick Hits | End User SharePoint
[...] HTML Calculated Column – Updated script [...]
July 17, 2009 at 6:19 pm
Suzanne
This rocks. Thanks so much for putting it together. And it’s so easy to use! I wanted friendly links to show and got exactly what I needed
July 22, 2009 at 6:39 pm
neil
does any of this color-coding work in datasheet view?
July 22, 2009 at 7:29 pm
Christophe
unfortunately no. The datasheet view is not html, it is an ActiveX (IE specific) control.
July 22, 2009 at 8:54 pm
Using calculated columns to write HTML « Path to SharePoint
[...] on 11/15/2008 – using calculated columns to write scripts: published on 2/26/2009 – preview panes: added on 7/9/2009 – filters: not published yet Also note the troubleshooting [...]
July 24, 2009 at 2:05 pm
Nancy
If I right-click on my list view in SPD and convert ot XSLT data view, I want those html columns to render just as they do in the regular list view.
You’re saying that there is no way for html columns to properly render in a data view?
July 24, 2009 at 2:14 pm
Christophe
Nancy, my reply was for the datasheet view – an Excel-like view based on ActiveX controls.
What you’re creating with SPD are Data View Web Parts, which render regular html.
July 24, 2009 at 2:16 pm
Nancy
What I was trying ot say was-
I use your formula to successfully render html in calculated columns in regular list views.
In SPD, if I want to convert the list view to XSLT data view, I lose the HTML formatting.
Are there changes to your script that will enable the HTML? Or some other way to get it back?
July 24, 2009 at 2:22 pm
Christophe
I see. I’ll try to publish the explanations this week.
August 4, 2009 at 7:04 pm
Rickey Whitworth
Hi Christophe. I love the script, I have used it so much that I would like to add it to my master page. I did this, and it worked everywhere except for the EditForm page of an list. When opening the EditForm.aspx page with this script in the master page, the page never loads and the browser becomes unresponsive. This is the case even if it is a list without a calculated html column. I tried it from 2 different machines, one with IE8 and one with IE 7. I also tried removing it from the master page and just adding it in a content query web part on the edit form, which I do not recommend because you cannot even open the page in edit mode after that.
Any ideas on what the problem might be or what I can troubleshoot.
August 4, 2009 at 7:38 pm
Rickey Whitworth
I should clarify, since I made a typo. When I add it the script to the master page, all of the editform.aspx pages lock on loading, even if there is not a calculated column. So it seems like maybe there is some kind of conflict here.