SharePoint (2003 thru Online): Color coding to your SharePoint list columns

Tuesday, April 29, 2014

Color coding to your SharePoint list columns

Color coding to your SharePoint list columns

We can also try this awesome FREE Tool. We need to install on the server where SharePoint is installed.While installation, this tool will verify the pre requisites.


http://www.pentalogic.net/sharepoint-products/free-stuff/html-calculated-column
MOSS 2007 setup
  1. Go to http://pathtosharepoint.com/Downloads/Forms/AllItems.aspx, expand the HTML Calculated Column group header and download a copy of the TextToHTML-v2.1.1 text file.
  2. Upload the HTML script file to a document library on your site. As you can see in the screen shot below, I uploaded my file to a document library named Site config files. It doesn't matter what document library you use to store your file, but make sure all site users have at least read-only access to the library you use. This will ensure the HTML script file can be accessed to render the color coding you’re going to set up.
  3. Validate that the SharePoint list or document library that you want to color code is set up with a Priority field with the following basic settings. (Note that these settings come with the out-of-the-box Priority site column, which you can add to your list or document library.)
  4. Browse the color formatting options at http://blog.pathtosharepoint.com/2008/09/01/apply-color-coding-to-your-sharepoint-lists/ and determine which option (e.g. traffic light indicator, font color shading, background shading, KPI icon indicator) you’d like to implement.
  5. Copy the formula provided for your desired formatting. In my case, I’m looking to implement a traffic light indicator so I copied the following formula:
    ="<DIV style=’font-weight:bold; font-size:24px; color:"&CHOOSE(RIGHT(LEFT(Priority,2),1),"red","orange","green")&";’>&bull;</DIV>"
  6. Add a new calculated column to your SharePoint list. Paste the HTML formula string you copied into the new column’s Formula field. Click OK to save your changes.

  1. When you return to your list view, you’ll see your new calculated column displaying with <DIV> tags. Not very attractive.

  1. To correct this issue, we’re going to add our HTML script to the page. Click on Site Actions > Edit Page.
  2. Click Add a Web Part and add a new Content Editor Web Part to your page.
  3. Move your new Content Editor Web Part (CEWP) to the bottom of the page. You need it to display below your list view web part.
  4. Click on the CEWP’s open the tool pane hyperlink.
  5. When the web part configuration panel appears, place your cursor in the Content Link field and enter the location where you stored your HTML script file. Click OK to save your changes.
That’s it! Your formatting is applied and your page should now display your new color coded field. Here’s a screen shot of my finished view, complete with a Priority Level column that displays red, yellow and green traffic lights that correlate with the priority level of each help desk request:

Now that you've set up color coding on one list view, you can continue adding more color coding to this view or add color coding to other views. Note that you will need to add one CEWP to each list view page that you want to color code. There is no limit, however, to the number of calculated columns with HTML encoding you can add to your list.
SharePoint 2010 setup
  1. Validate that the SharePoint list or document library that you want to color code is set up with a Priority field with the following basic settings. (Note that these settings come with the out-of-the-box Priority site column, which you can add to your list or document library.)
  2. Browse the color formatting options at http://blog.pathtosharepoint.com/2008/09/01/apply-color-coding-to-your-sharepoint-lists/ and determine which option (e.g. traffic light indicator, font color shading, background shading, KPI icon indicator) you’d like to implement.
  3. Copy the formula provided for your desired formatting. In my case, I’m looking to implement a traffic light indicator so I copied the following formula:
    ="<DIV style=’font-weight:bold; font-size:24px; color:"&CHOOSE(RIGHT(LEFT(Priority,2),1),"red","orange","green")&";’>&bull;</DIV>"
  4. Add a new calculated column to your SharePoint list. Paste the HTML formula string you copied into the new column’s Formula field. Click OK to save your changes.
  5. When you return to your list view, you’ll see your new calculated column displaying with <DIV> tags. Not very attractive.
  6. To correct this issue, we’re going to need to modify this new calculated column. Open your site in SharePoint Designer 2010.
  7. Click on Lists and Libraries in your SharePoint Designer 2010 navigation bar. When the list of your site’s document libraries and lists display, click on the list or document library we’re working on.
  8. When the list or document library details page displays, look for and click on the name of the view you’re applying color coding to. In my case, I am updating the All Issues view.
  9. Once your view opens, click on of the fields that are displaying those ugly
    tags. Notice that the <xsl:value-of> tag in the bottom right-hand corner of your screen lights up in yellow once your field is selected.
  10. Hover over the <xsl:value-of> tag until a black drop-down arrow appears. Click on the drop-down arrow and select Edit Tag…
  11. A dialog box will pop up with the following text:
    Place your cursor between the last quotation mark and the closing > bracket. Now type the text disable-output-escaping=“yes”
  12. Your Quick Tag Editor box should now read like this:
  13. Click on the Quick Tag Editor box’s green check mark icon to save your changes. Your SharePoint Designer page will refresh and your color coding will appear!
  14. Click File > Save to save your changes.
That’s it! Your formatting is applied and your page should now display your new color coded field. Here’s a screen shot of my finished view, complete with a Priority Indicator column that displays red, yellow and green traffic lights that correlate with the priority level of each help desk request:
Now that you've set up color coding on one list view, you can continue adding more color coding to this view or add color coding to other views. Note that you will need to modify the <xsl:value-of> tag for each column you want to display in HTML format. There is no limit, however, to the number of calculated columns with HTML encoding you can add to your list.

No comments:

Post a Comment