I created the BASIC example below that illustrates and replicates the bug. You can copy this code into any Writer document's Basic IDE, compile it, then run the macros as I'll outline. The problem is that I can create a User Defined Property from a BASIC macro, and I can then access it, and print its current value. But if I try to use another macro to delete the UDP, I get a run-time error. (It gets even weirder than this.) You can reproduce this bug as follows: First of all, you can run BugTest1() to create the UDP, "UDP1" with value: "This is a User Defined Property!" Next, run BugTest2(). It will simply access the new UDP and print its current value in a MsgBox(). So far, so good. Now comes the bizarre behavior. Now run BugTest3() which simply tries to delete the newly created UDP. (By DeleteUDProperty("UDP1")) It results in a run-time error. There is more odd behavior to explain here. To begin with, after you've run BugTest1() to create the UDP, then go to File --> Properties --> Custom Properties, you won't find the newly created UDP listed there. BUT -- when you run BugTest2() it can somehow access it, and display its value. BugTest3() as shown cannot delete it. Now, if you've run the three tests, had the run-time error, and now save the file AND CLOSE IT, then reopen it, then look at the UDPs (File --> Properties --> Custom Properties) you'll see that the UDP we created with BugTest1() has suddenly shown up in the list. If you NOW run ButTest3(), you'll see that the UDP can now be successfully deleted by the macro without generating any run-time error. Again, you can use BugTest1() to create the UDP, then click on the Save icon to save the file, and still the UDP will not be listed in the Custom Properties. You must actually close the document, and then reopen it to get it listed. I can also confirm that this bug is present in OpenOffice 4.1.6 and behaves exactly the same, so this was almost certainly something that Libre inherited when it was forked. (I also upgraded to Libre 6.3.4.2 before filing this report, just to make sure it still persists.) Being a long-time, amateur programmer, the most likely explanation that I can think of for this behavior is that the UDPs appear to be read from the document into some temporary store that is accessed by all the macro functions (hasPropertyByName(), addProperty(), setPropertyValue() and getPropertyValue()). Whatever modifications occur here seem to be held back and are only written to the document when it is closed. On the other hand, removeProperty() seems to access a different store of the UDPs, possibly the document itself, so it can't delete a UDP that the other functions create until AFTER the document has actually been closed and reopened. I hope this is a clear-enough explanation of what's happening. Thanks. ' ------------------------------------------------------------------------------------------------- Sub CreateUDProperty(UDProp As String, Value As String) DocUDProps = ThisComponent.DocumentProperties.UserDefinedProperties If DocUDProps.getPropertySetInfo().hasPropertyByName(UDProp) = false Then DocUDProps.addProperty(UDProp, 0, Value) Else DocUDProps.setPropertyValue(UDProp, Value) End If End Sub Sub DeleteUDProperty(UDProp As String) DocUDProps = ThisComponent.DocumentProperties.UserDefinedProperties If DocUDProps.getPropertySetInfo().hasPropertyByName(UDProp) = True Then MsgBox("About to delete " & UDProp) MsgBox("Current value of " & UDProp & " is " & DocUDProps.getPropertyValue(UDProp)) DocUDProps.removeProperty(UDProp) End If End Sub Sub BugTest1() CreateUDProperty("UDP1", "This is a User Defined Property!") MsgBox("Created UDP1.") End Sub Sub BugTest2() DocUDProps = ThisComponent.DocumentProperties.UserDefinedProperties If DocUDProps.getPropertySetInfo().hasPropertyByName("UDP1") Then MsgBox("Here is UDP1: " & DocUDProps.getPropertyValue("UDP1") Else MsgBox("Can't find UDP1!") End If End Sub Sub BugTest3() DeleteUDProperty("UDP1") End Sub
confirming, but i think the root cause is a missing "refresh": Summary: After adding a property, it is not shown in dialog: Menu File/Properties/[Custom Properties] But it will be shown after a save & reload cycle. And once it's shown in properties dialog, one can delete it.
Hi! I investigated the error and I think the custom document property should be created using something like: Sub AddNewDocumentProperty(UDProp As String, Value As String) Dim oUDP oUDP = ThisComponent.getDocumentProperties().UserDefinedProperties If NOT oUDP.getPropertySetInfo().hasPropertyByName(UDProp) Then oUDP.addProperty(UDProp, _ com.sun.star.beans.PropertyAttribute.REMOVEABLE , _ Value) End If End Sub Without the REMOVEABLE flag, the property cannot be removed. After I add a property using the above method, even the dialog in Menu File/Properties/[Custom Properties] shows it. In addition, Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community Build ID: b336dca9864390a0e19ae3f4518725eba6be2ffc CPU threads: 6; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win Locale: de-DE (de_DE); UI: en-US Calc: CL shows a BASIC error message with com.sun.star.beans.NotRemoveableException. Possible options for the property options are: MAYBEVOID 1 The property value can be void. BOUND 2 A PropertyChangeEvent will be fired to all registered property change listeners when the value of this property changes. CONSTRAINED 4 A PropertyChangeEvent will be fired to all registered vetoable change listeners when the value of this property changes. TRANSIENT 8 The property value is not saved with the document. READONLY 16 The property value is read-only. MAYBEAMBIGUOUS 32 The property value may be ambiguous. MAYBEDEFAULT 64 The property can be set to default. REMOVEABLE 128 The property can be removed. This used to be called REMOVABLE. OPTIONAL 256 The property is optional.
Imho the bug is that the custom properties dialog should show the item, but not give the possibility to delete it.
However, after a reload of the document, the flags are lost since the ODS standard[1] does not allow to save any additional flags. [1] https://docs.oasis-open.org/office/OpenDocument/v1.3/cs01/part3-schema/OpenDocument-v1.3-cs01-part3-schema.html#__RefHeading__1415128_253892949
Dear atemple, 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