Description: When creating a new color scale conditional formatting, the *ColorScaleEntries* array is empty and I was not able to find any way to create any new *com.sun.star.sheet.XColorScaleEntry* entry in it (2 or 3, depending of which color scale). Furthermore, when editing this newly created color scale conditional formatting with the Conditional Formatting graphic tool in Calc, Calc crashes ! (I used Xray to see the structure.) *************************** Sub addColorScaleCF Dim oDoc As Object Dim oRanges As Object 'Method "createByRange" needs a range collection Dim oSheet As Object Dim oRange As Object Dim EveryCF As Object Dim NewCF As Object oDoc = ThisComponent oRanges = oDoc.createInstance("com.sun.star.sheet.SheetCellRanges") oSheet = oDoc.Sheets.getByIndex(0) oRange = oSheet.getCellRangeByName("A1:A4") 'Add oRange to the range collection oRanges.insertByName("", oRange) 'Get Every CF in sheet EveryCF = oSheet.ConditionalFormats 'Add a new CF EveryCF.createByRange(oRanges) 'Get the newly created CF NewCF= EveryCF.ConditionalFormats(EveryCF.Length - 1) 'Add a new entry (color scale) in the CF NewCF.createEntry(com.sun.star.sheet.ConditionEntryType.COLORSCALE, 0) 'Explore the new entry 'Xray NewCF.getByIndex(0) End Sub *************************** Xray RESULTS ============= ColorScaleEntries []com.sun.star.sheet.XColorScaleEntry <empty> ImplementationId []byte <empty> (get), read-only PropertySetInfo com.sun.star.beans.XPropertySetInfo (get), read-only Type long 1 (get), read-only Types []type (get), read-only *************************** (Maybe it is not a bug and I missed something about filling the *ColorScaleEntries* array...) Steps to Reproduce: 1. Open any Calc document. 2. Execute the macro 3. Edit the newly created conditional formatting Actual Results: Depends on the action : If editing the new CF, crash ! But, basically, I think the problem is the emptyness of the *ColorScaleEntries* array. Expected Results: *ColorScaleEntries* array filled with editable entries. Reproducible: Always User Profile Reset: No Additional Info:
Created attachment 144560 [details] conditionalformat it is possible to read the "ColorScaleEntries" from a manually created conditional format, see attached file. so i think, you have to fill the "ColorScaleEntries" to make it work. the question is how can this be done? I found a service "ColorScale" but don't know how to instantiate: https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1sheet_1_1ColorScale.html
Reading the "ColorScaleEntries" property from a manually created format was the way I used to see the structure with 2 or 3 items depending on the color scale I created. I spent a lot of time trying to manipulate the service you mentionned, as well as trying to create a "ColorScaleEntry" object directly in order to add it to the sequence "ColorScaleEntries", even if I couldn't be able to find a way to add anything to it... It seems methods or constructors are missing... Or it is me who is missing something...
How to install XRay? I gave a try by downloading file from http://berma.pagesperso-orange.fr/index.html when click "Install" button present in the doc. I noticed these logs on console: warn:basic:9094:9094:basic/source/uno/namecont.cxx:916: couldn't open sub storage for library "Standard". Exception: (com.sun.star.io.IOException) { { Message = "/home/julien/lo/libreoffice/package/source/xstor/xstorage.cxx:2381: ", Context = (com.sun.star.uno.XInterface) @0 } } warn:stoc:9094:9094:stoc/source/inspect/introspection.cxx:1636: object of type "com.sun.star.beans.XIntrospectionAccess" lacks XTypeProvider Nevertheless, I gave a try to your macro and had this message in LO: "BASIC runtime error. Sub-procedure or function procedure not defined."
i use mri instead of xray, https://github.com/hanya/MRI/releases
(In reply to Oliver Brinzing from comment #4) > i use mri instead of xray, https://github.com/hanya/MRI/releases I installed mri, it hangs at the end so had to kill LO. Nevertheless after restarting LO, the module displayed. Then I copy paste the macro and replace the Xray line by Mri NewCF.getByIndex(0) Again: "BASIC runtime error. Sub-procedure or function procedure not defined."
I don't know why you have problems with Xray, MRI or this macro. Maybe try to start with a fresh install of LibreOffice (I mean an empty profile).
(In reply to Fab from comment #6) > I don't know why you have problems with Xray, MRI or this macro. > Maybe try to start with a fresh install of LibreOffice (I mean an empty > profile). The macro works (or at least, I don't have any error message) until I uncomment Xray (or mri) line. I build LO from master sources and profile was clean. But certainly someone may help you anyway.
This problem remains with LibreOffice 6.1.1.2...
Version must correspond to the oldest one.
(In reply to Julien Nabet from comment #9) > Version must correspond to the oldest one. Oh, tanks ! I missed that. :)
If this is to be treated as a documentation issue, maybe try https://ask.libreoffice.org/ and if that does not help, the developer mailing list.
(In reply to Buovjaga from comment #11) > If this is to be treated as a documentation issue, maybe try > https://ask.libreoffice.org/ and if that does not help, the developer > mailing list. no, as mentioned above, i think the problem is, that it seems not to be possible to instantiate the "com.sun.star.sheet.ColorScale" service.
Well, then this should go to NEW
Indeed, it really seems that the possibility of instantiating the "com.sun.star.sheet.ColorScale" service or the possibility of instantiating the "com.sun.star.sheet.XColorScaleEntry" object would solve this problem. Or maybe the "createEntry" method, when used with com.sun.star.sheet.ConditionEntryType.COLORSCALE (=1) as first argument, should accept one more argument (optional) that would be the type of the colorscale conditional format (2 or 3 colors).
Dear Fab, To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug
This is confirmed to still be an issue in 7.4.6.2: Version: 7.4.6.2 (x64) / LibreOffice Community Build ID: 5b1f5509c2decdade7fda905e3e1429a67acd63d CPU threads: 16; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win Locale: en-US (en_US); UI: en-US Calc: CL Additionally, the other conditional formats of Data Bar, Icon Set, and Date don't appear to be available via macros either - only the Condition type is available.