Skip to main content
Ben Nadel at cf.Objective() 2010 (Minneapolis, MN) with: Ilya Fedotov
Ben Nadel at cf.Objective() 2010 (Minneapolis, MN) with: Ilya Fedotov ( @ilyafedotov )

Minor CSSRule.cfc ColdFusion CSS Parser Update

By on
Tags:

As part of my ColdFusion custom tag solution for generating Microsoft Excel files, I am going to be using my CSSRule.cfc ColdFusion component to allow users to use CSS-like styling to format the Excel document. To make the CSSRule.cfc more useful, I have added the support of the Color property (not sure how I missed that one before) and I have added three new methods:

AppendCSSRule( CSSRule )

This takes one CSSRule.cfc instance and adds its properties to the current CSSRule.cfc instance. It will only overwrite properties that have a value (it will not copy over empty string values). This gives the passed-in instance a higher cascading precedence.

GetRuleString( [IncludeEmptyValues] )

Converts the CSSRule.cfc property map into style-type attribute values (Ex: property = value ; property = value ;). By default, it will not include empty property values in the resultant string unless explicitly asked to do so via the IncludeEmptyValues argument.

PrependCSSRule( CSSRule )

This is a lot like the AppendCSSRule() method, but it treats the style cascading in a reverse fashion. This takes one CSSRule.cfc instance and adds its properties to the current CSSRule.cfc instance, but, it only adds the new property value if that property is not already defined in the current property map. This gives the current instance a higher cascading precedence.

The new download for this has been placed in the CSSRule.cfc project page. Going forward on the POI project, I am going to break off a new version of the CSSRule.cfc and make it tailored for applying CSS style values to a POI HSSFCell style object.

Reader Comments

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel