Access to ConditionalFormat StyleName and DateType property

Java, C++, C#, Delphi, ??? - Using the UNO bridges

Access to ConditionalFormat StyleName and DateType property

Postby busyroofer » Tue Sep 03, 2019 7:57 pm

The spreadsheet Sheet1 has a conditional 'date is' 'this month' style 'good' with range $G$1:$H$1048576. Unexpectedly the script logs StyleName as 'good' and the DateType as 'good'. Note that MRI recognized the type as long but prints a string when inspected. Am I doing something wrong?

SCRIPT OUTPUT

2019.09.03-17:54:05 : ::ConditionalFormat: range=$Sheet1.$G$1:$H$1048576 id=1 type=4 style=Good date=Good

MRI OUTPUT

Code: Select all   Expand viewCollapse view
com.sun.star.beans.XPropertySet

(Name)            (Value Type)             (Value)      (Info.)   (Attr.)    (Handle) 
DateType          long                     Good                                0 
ImplementationId  []byte                   -SEQUENCE-   Pseud     Read_Only       
PropertySetInfo   .beans.XPropertySetInfo  -INTERFACE-  Pseud     Read_Only       
StyleName         string                   Good                                0 
Type              long                     4            Pseud     Read_Only       
Types             []type                   -Sequence-   Pseud     Read_Only       


Code: Select all   Expand viewCollapse view
    sheet = sheet_by_name( 'Sheet1' )                                # com.sun.star.sheet.XSpreadsheets
    formats = sheet.getPropertyValue( 'ConditionalFormats' )         # com.sun.star.sheet.XConditionalFormats
    for format in formats.getConditionalFormats( ):                  # com.sun.star.sheet.XConditionalFormat
        cellrange = format.Range                                     # com.sun.star.sheet.XSheetCellRanges
        identifier = format.ID                                       # long = 1
        propertySet = format.getByIndex( 0 )                         # com.sun.star.beans.XPropertySet   
        conditionType = propertySet.getType( )                       # com.sun.star.sheet.XConditionEntry ConditionEntryType = 4 (DATE)
        styleName = propertySet.getPropertyValue( 'StyleName' )      # com.sun.star.beans.XPropertySet = (String) Good
        dateType = propertySet.getPropertyValue( 'DateType' )        # com.sun.star.beans.XPropertySet = (String) Good???
                                                                     #        expected com::sun::star::sheet::DateType = (long) 7 THISMONTH
        log_write( '::ConditionalFormat: range={} id={} type={} style={} date={}'.format( cellrange.AbsoluteName, identifier, conditionType, styleName, dateType ) )
LibreOffice, Version: 6.3.0.4 (x64), OS: Windows 10.0
busyroofer
 
Posts: 2
Joined: Tue Sep 03, 2019 6:46 pm

Re: Access to ConditionalFormat StyleName and DateType prope

Postby busyroofer » Wed Sep 04, 2019 5:03 pm

Changed to direct access of the StyleName and DateType properties by de-referencing the propertySet. First run crashed hard with an application exit. Send run gave same incorrect results as shown. Wonder if this is some sort of .idl language binding problem?

2019.09.04-10:49:08 : ::ConditionalFormat: range=$Sheet1.$G$1:$H$1048576 id=1 type=4 style=Good date=Good

styleName = propertySet.StyleName
dateType = propertySet.DateType

NOTE: The GUI works fine.
LibreOffice, Version: 6.3.0.4 (x64), OS: Windows 10.0
busyroofer
 
Posts: 2
Joined: Tue Sep 03, 2019 6:46 pm


Return to External Programs

Who is online

Users browsing this forum: No registered users and 2 guests