Removing conditional formats via UNO in LibreOffice

Florian Haftmann florian.haftmann at
Wed Oct 1 08:06:12 PDT 2014

Hi all,

I am locked up in a situation where I want to *remove* an existing
conditional format from a cell range. The minimal example (supposed to
be run in a spreadsheet context) looks as follows:

sub remove
  dim sheet as variant
  dim cell as variant
  dim cond as object

  sheet = thisComponent.sheets.getByIndex(0)
  cell = sheet.getCellByPosition(3, 0)

  cond = cell.conditionalFormat
  cell.conditionalFormat = cond
end sub

In 3.21, this last three lines would effectively
*replace* the pre-existing conditional format attached to cell (3, 0).
In the meantime (since LibreOffice and still in the
semantics has changed such that the re-assignment in the last line does
not replace pre-existing conditional formats but *adds* another (here,
empty) conditional format entry to the cell.  Btw. the same occurs if I
operate on a whole cell range rather than a single cell.

I guess this change is mainly due to conditional formats now applying to
whole cell ranges rather then single cells.

So, my question:
a) Is this subtle change above a breakdown or a deliberate change of the
API semantics?
b) If the change is deliberate, how am I supposed to remove existing
conditional formats now?
c) If the change is a breakdown, I am willing to examine further details

Thanks a lot,


PGP available:

More information about the LibreOffice mailing list