• Sign In
 
  • MSDN Blogs
  • Microsoft Blog Images
  • More ...
Search
  • Advanced search options...
Tags
  • .NET
  • Altova
  • blogging
  • code samples
  • Codeplex
  • Custom XML
  • DII
  • DIS29500
  • ECMA-376
  • IBM
  • Java
  • Monarch
  • ODF
  • Office 2007
  • OpenXMLDeveloper.org
  • PHP
  • Redmond
  • SharePoint
  • System.IO.Packaging
  • TechEd
  • UOF
  • VSTO
  • Windows
  • WordprocessingML
  • workshops
Archives
Archives
  • January 2012 (1)
  • October 2011 (1)
  • July 2011 (2)
  • April 2011 (1)
  • March 2011 (3)
  • December 2010 (1)
  • August 2010 (1)
  • June 2010 (1)
  • May 2010 (1)
  • April 2010 (3)
  • March 2010 (1)
  • November 2009 (4)
  • October 2009 (1)
  • September 2009 (2)
  • July 2009 (2)
  • June 2009 (4)
  • May 2009 (5)
  • April 2009 (4)
  • March 2009 (4)
  • February 2009 (2)
  • January 2009 (4)
  • December 2008 (4)
  • November 2008 (3)
  • October 2008 (4)
  • September 2008 (3)
  • August 2008 (2)
  • July 2008 (5)
  • June 2008 (7)
  • May 2008 (5)
  • April 2008 (8)
  • March 2008 (14)
  • February 2008 (15)
  • January 2008 (13)
  • December 2007 (12)
  • November 2007 (5)
  • October 2007 (9)
  • September 2007 (6)
  • August 2007 (10)
  • July 2007 (9)
  • June 2007 (8)
  • May 2007 (12)
  • April 2007 (14)
  • March 2007 (12)
  • February 2007 (10)
  • January 2007 (17)
  • December 2006 (14)
  • November 2006 (10)
  • October 2006 (11)
  • September 2006 (12)
  • August 2006 (12)
  • July 2006 (12)
  • June 2006 (23)
  • May 2006 (14)
Common Tasks
  • Blog Home
  • Email Blog Author
  • About
  • RSS for comments
  • RSS for posts

Conditional Formatting

Doug Mahugh - Office Interoperability
MSDN Blogs > Doug Mahugh > Conditional Formatting

Conditional Formatting

Doug Mahugh
2 Oct 2007 10:18 AM
  • Comments 1

Scott Ruble has a post on on the Excel team blog today, asking for feedback on the databars functionality that was introduced in Excel 2007. This is a very popular new capability, and part of a more general concept known as "conditional formatting," where various types of formatting are applied to cells to indicate the relative magnitude of the values in those cells.

Scott's post presents a few scenarios and asks for feedback on what people would like to see done in those cases. If you're a conditional formatting user, please drop in and share your opinions so that the Excel team can benefit from your feedback.

Here, I'm going to talk a bit about how conditional formatting is stored in Open XML spreadsheet documents, for developers who want to include conditional formatting in documents they generate.

Let's start with a simple example of conditional formatting, a sample document from the developer workshop content on OpenXMLDeveloper.org:

This example shows two types of conditional formatting: dataBar (as in Scott's example) is used in the first column, and the other two columns use iconSet formatting. The iconSet option allows for various collections of icons to be used, and these two examples are 3Arrows and 4Rating, respectively.

Conditional formatting information is stored in the worksheet part as conditionalFormatting elements, which occur after the sheetData element. The worksheet data values are stored in sheetData, and the sqref attribute of conditionalFormatting specifies the range of cells that each rule applies to.

Once you understand this basic structure, most of the details are simple. You can add a showValue="0" attribute added to dataBar element to supress display of the actual numeric values, for example. For the iconSet rules, you can specify any one of 17 pre-defined lists of icons, as specified in section 3.18.44 ST_IconSetType (Icon Set Type). For more information on conditional formatting rules in general, see section 3.3.1.9 (cfRule) and 3.3.1.17 (conditionalFormatting).

In some cases you might want the icon-set conditional formatting to distribute the icons non-uniformly across the range of values. For example, instead of having red/yellow/green correspond to the lowest third, middle third, and highest third of the range, you might want to only use the red or green icon for the bottom or top 10% of the range. In that case, you'd change the values in the cfvo elements (conditional formatting value objects) to 10, 80, and 10, respectively.

Conditional formatting is a great way to enhance spreadsheets, and it's very easy to do.

  • 1 Comments
Comments
  • Techy News Blog » Conditional Formatting
    2 Oct 2007 10:28 AM

    PingBack from http://www.artofbam.com/wordpress/?p=4550

Page 1 of 1 (1 items)
  • © 2012 Microsoft Corporation.
  • Terms of Use
  • Trademarks
  • Privacy Statement
  • Report Abuse
  • 5.6.402.223