https://bugs.documentfoundation.org/show_bug.cgi?id=171950

--- Comment #3 from Neil Roberts <[email protected]> ---
I had a go at making a patch to improve the API here:

https://gerrit.libreoffice.org/c/core/+/205944

With that you could implement your example with code like this:

    cf.createEntry(COLORSCALE3, 0)
    entry = cf[0]

    entry.ColorScaleEntries[0].Formula = "0"
    entry.ColorScaleEntries[0].Color = 0xFF0000
    entry.ColorScaleEntries[0].Type = 0

    entry.ColorScaleEntries[1].Formula = "50"
    entry.ColorScaleEntries[1].Color = 0xFFFFFF
    entry.ColorScaleEntries[1].Type = 2

    entry.ColorScaleEntries[2].Formula = "0"
    entry.ColorScaleEntries[2].Color = 0x00FF00
    entry.ColorScaleEntries[2].Type = 1

Note however there are still a few other related problems:

* The conditional format that is created isn’t immediately available in the
document. See tdf#172333.
* Setting a formula for the COLORSCALE_FORMULA type isn’t implemented. See the
TODO in ScColorScaleEntryObj::setFormula. This doesn’t matter for this
particular example though.
* If you run the example as an external script then there seems to be a
ref-counting issue and LibreOffice crashes. If you run it as a macro then it
works fine though.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to