How to add color scales to ODF?

Markus Mohrhard markus.mohrhard at googlemail.com
Fri May 11 17:39:02 PDT 2012


Hey,


2012/5/11 Kohei Yoshida <kohei.yoshida at gmail.com>:
> On Fri, 2012-05-11 at 19:48 +0200, Markus Mohrhard wrote:
>> 2012/5/11 Kohei Yoshida <kohei.yoshida at gmail.com>:
>
>> > Come to think of it, how are we dealing with these unique values,
>> > non-unique values conditions in ODF, which has similar range
>> > requirement to color scales (and data bars)?
>> >
>>
>> The unique value condition is not saved to odf. See
>> 11d375a4e719ce4836015020d2f120765672fb09
>
> Wow.  Ok. :-(
>
>> So if we find a solution here for color scales we might use the same
>> solution to export this to odf.
>
> Yup, that makes logical sense.
>

I have thought a bit more about it and had a closer look at our the
"unique value" conditional format and discussing the problem a bit
with Eike on IRC I think the best solution would be to move all
conditional format entries out of the style section and only reference
the styles later. I just fear that this is such a big incompatible
change that we will not get this into ODF.

Advantages:
- clean: separates the information, style assigned to cell,
conditional format, conditional format entries
- respects that conditional formats are not really part of styles,
some of them just use styles
- includes the range
- styles are only referenced by conditional formats, conditional
formats are no longer a set of conditional styles
- extendable (data bars/icon sets are still missing/)
Disadvantages:
- incompatible changes
- maybe would not make it through the oasis committee

The other not so clean solution but more likely accepted solution is
to add also a new section for conditional formats. But instead of
moving all conditional formatting information just store the range in
this section.

Advantages:
- less invasive
- will not break compatibility

Disadvantages:
- need to introduce some non style parts into the style section
- not easily extendable
- information about conditional formats are divided between two places
- looks horribly wrong if you write a the structure into xml and think
about what it actually means (I know this is a bad a

I have attached a simple structure that shows the concepts behind the
first ideas. The second one is just the current implementation with an
additional section mentioning the range of a conditional format.

Regards,
Markus
-------------- next part --------------

<style section>
    <style name="st1"/>
    ...
</style section>

<sheet>
    <row>
        <cell style="st1"/>
        <cell style="st2"/>
    </row>
    <conditionalFormats>
        <condFormat range="A1:B4">
            <some_form_condformat style="st3"/>
            <colorScale>
                <colorScaleEntry type="min" col="aaaaaa"/>
                <colorScaleEntry type="max" col="ffffff"/>
            </colorScale>
            <dataBar>
            ...
            </dataBar>
        </condFormat>
        <condFormat range="H3:M17">
        ...
        </condFormat>
    </conditionalFormats>
</sheet>


More information about the LibreOffice mailing list