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

Mike Kaganski <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |NOTABUG
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Mike Kaganski <[email protected]> ---
1. Option VBASupport 1 is irrelevant here, since we discuss LibreOffice UNO
API.

2. You define a conditional formatting formula. *When added*, Calc needs to
know how to interpret the formula text - including the relative addressing
(i.e., what does the AA mean in your "NOT(ISBLANK(AA$1))" - the "AA" is
relative, but relative to what?). From reading the code, a human will easily
see that you obviously intend to use AA2 as the base address; but in line
"oFormat.addNew(oCondition)", this is unknown to Calc, because oCondition has
no information about that. Calc will have to assume some *default* base address
when compiling the formula, which is, naturally, A1; thus, the formula will
become "NOT(ISBLANK(<cell in row 1, column right to current by 26>))". And when
you apply this compiled formula to range AA2:AF10, it will naturally be shown
as "NOT(ISBLANK(BA$1)", 26 columns to the right relative to AA2.

3. As explained in the XSheetConditionalEntries Interface Reference [1], there
is SourcePosition property to define the base address for relative cell
references in formulas. If you add the following lines before
"oFormat.addNew(oCondition)":

        Dim oSourcePosition As New com.sun.star.table.CellAddress
        oSourcePosition.Sheet = 0
        oSourcePosition.Column = 26
        oSourcePosition.Row = 1
        oCondition(3).Name = "SourcePosition"
        oCondition(3).Value = oSourcePosition

it will have all the needed info, and the result would be as you expect.

4. (Offtopic) Note that Dim oCondition(3) creates the array of four elements,
from 0 to 3.

[1]
https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1sheet_1_1XSheetConditionalEntries.html

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

Reply via email to