Apache OpenOffice (AOO) Bugzilla – Issue 93815
Custom properties of DocumentInfo are not accessible by BASIC code
Last modified: 2022-07-23 14:53:59 UTC
Try the following code in any OOo document (I've already tried it on Writer documents and on Base forms): Sub Main if ThisComponent.DocumentInfo.PropertySetInfo.hasPropertyByName("MyProperty") then ThisComponent.DocumentInfo.MyProperty="MyValue" else ThisComponent.DocumentInfo.addProperty("MyProperty",193,"MyValue") endif print ThisComponent.DocumentInfo.MyProperty ' It prints a null string REM you have to install XRayTool to run this line Xray ThisComponent.DocumentInfo REM XRay tool shows the correct string "MyValue" in "MyProperty" but when you REM double click on it, it shows a null string (really weird). End Sub In conclusion every time I try to access a custom property from DocumentInfo the program returns a null string. This was not the case with previous versions. I tried it only on OOo 3 RC1 under Win XP.
Created attachment 56467 [details] A demo text file for this issue. Search the BASIC code.
I made some tests and I found out that it is more complicated. hasPropertyByName method always returns true. I don't know if assignment works because accessing a custom property always returns a null string but in XRayTool the value is visible. Please ab, can you investigate what the real problem is and change the description? thank you.
Needs to be evaluated
Forgot to set to STARTED, OOo 3.x
Please search the possibility that DocumentInfo service is depreciated in OOo 3.0 SDK. I don't have access to this SDK yet.
Reset assigne to the default "issues@openoffice.apache.org".
Checking the issue with three versions: - in 2.4.3 the program works as expected by the reporter - in 3.0.0 it returns a null string indeed - interestingly, in 4.1.12 it returns "MyValue". The 3.0 SDK documentation states that the DocumentInfo service is deprecated and recommends using the DocumentProperties service instead. The online IDL reference provides the same information (cf. the attached file). Fixing the code in line with the new specs gives the desired effect. Thus I see no real defect in this issue.
Created attachment 87140 [details] info: SDK 3.0 and online reference