HTML Calculated Column – Updated script v2.1

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:

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).

15 thoughts on “HTML Calculated Column – Updated script v2.1

  1. Pingback: 2009-07-09 Today's Quick Hits | End User SharePoint

  2. 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 🙂

  3. Pingback: Using calculated columns to write HTML « Path to SharePoint

  4. 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?

    • 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.

  5. 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?

  6. 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.

    • 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.

  7. Hi Christophe,

    I’m trying to use this on my task list in Foundation 2010. I’m using the latest version. But when I group items, any item that is rendered last shows only the text. I’ve done some investigation, and it seems that the textToHtml function isn’t being called for that item. Any ideas what may be causing that?

    Thanks in advance…


Comments are closed.