Removing conditional formats via UNO in LibreOffice

Florian Haftmann florian.haftmann at informatik.tu-muenchen.de
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
  cond.clear()
  cell.conditionalFormat = cond
end sub

In OpenOffice.org 3.21, this last three lines would effectively
*replace* the pre-existing conditional format attached to cell (3, 0).
In the meantime (since LibreOffice 4.1.6.2.0 and still in 4.3.1.2) 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
also.

Thanks a lot,
	Florian

-- 

PGP available:
http://home.informatik.tu-muenchen.de/haftmann/pgp/florian_haftmann_at_informatik_tu_muenchen_de


More information about the LibreOffice mailing list