How to add color scales to ODF?

Markus Mohrhard markus.mohrhard at googlemail.com
Thu May 10 18:20:37 PDT 2012


Hey Thorsten,

>> I'm open for suggestions how I can add this sanely to ods. I would
>> like to support as much from MSO 2010's color scale feature as
>> possible but have no idea yet what I can achieve in the remaining 4
>> weeks.
>>
> Hi Markus,
>
> you're the man on the ground, so I'd guess you'll know best how to
> do it, and do it future-proof. That said, conceptually, ODF has
> historically preferred attributes over too deeply nested element
> hierarchies - which tend to provide less structure.
>

The question here is more how to deal with having the conditional
formatting information stored inside the style section. Color scales
and data bars are a special form of conditional formatting that have
nothing to do with styles. I could add them with some work into the
styles section of the ods file but this just feels wrong.

A possible way a color scale entry would look like is:

<colorScale range="$A$4:$D$10">
  <entry type="value" val="10" col="ff11ff">
  <entry type="max" col="ffffff">
</colorScale>
<colorScale range="$H3:$I$20">
  <entry type="min" col="ff11ff">
  <entry type="percent" val="30" col="aaaaaa">
  <entry type="percent" val="70" col="bbbbbb">
  <entry type="max" col="ffffff">
</colorScale>

For color scales and data bars( that are more or less just another way
to represent the same information ) there are quite some differences
to normal conditional formatting. One important difference is that the
range the color scale is applied to is really important (min, max,
percent, percentile) don't make sense without a range. They don't
refer to a fixed style information, the color mentioned in the xml is
only there to calculate the real color. I think the types are totally
different to the types defined for normal conditional formatting,
except for formula and value they always refer to the range.

I know that these ideas and comment don't really help finding a
solution for my problem but right now I mostly know what color scales
are not. And the first thing I had to learn is that they don't really
fit into our existing conditional formatting system. This is not
limited to odf, I have exactly the same problem with style system vs.
dynamically calculating the formatting information in my
implementation

Regards,
Markus


More information about the LibreOffice mailing list