Hi all,

Alexandro, I had spotted the XDocumentProperties interface. I had seen it's 
meant to provide document properties but I had put it aside until I could get 
event notifications sorted out.

In that interface, there are only 2 suitable methods to read (or "load") 
properties: loadFromStorage and loadFromMedium. Both of these have [in] 
parameters only and both return void... So I'm wondering, how is the client 
code supposed to retrieve the value of say, the ModifiedBy attribute?

The documentation isn't clear at all. For instance, the second parameter in 
both functions is explained to be a 
MediaDescriptor:http://www.openoffice.org/api/docs/common/ref/com/sun/star/document/MediaDescriptor.html
 says "So this descriptor should be used as an in/out parameter." but the 
parameter is specified in loadFromMedium as "[in]".


I haven't found sample code that retrieves document properties with 
XDocumentProperties. Here's what I tried:
        if (docPropsSupplier != null) {
            XDocumentProperties docProps = 
docPropsSupplier.getDocumentProperties();
            if (url != null) {
                List<PropertyValue> propertiesToFetch = getPropertiesToFetch();
                PropertyValue[] propsArray = propertiesToFetch.toArray(new 
PropertyValue[0]);
                try {
                    docProps.loadFromMedium(url, propsArray);
                } catch (WrongFormatException e) {
                …

(The "url" was retrieved earlier in the code.)

I thought propsArray would somehow be filled with the properties (Author, 
Title, etc.) that I was interested in. That didn't happen (verified by 
debugging the extension), which isn't really surprising since the parameter is 
labeled "[in]". Just for the sake of trying, I also tried the call with an 
empty propsArray, thinking that maybe the entire set of available properties 
would be retrieved. To no avail.

Therefore, as is, the call to loadFromMedium has no effect as far as my client 
code is concerned. I'm back to square one.

To sum up, I just want to sysout a property (e.g. the original author) of a 
document but I don't succeed in getting that information in a variable.

Does anyone see what I could be doing wrong here? Are the loadFromMedium calls 
supposed to have a side effect, making the properties available via some other 
mechanism?

Thank you.




Le Mercredi 25 juin 2014 18h36, Alexandro Colorado <j...@oooes.org> a écrit :
 


Here is some documentaion on file properties under the XDocumentProperties
https://wiki.openoffice.org/wiki/API/Samples/Java/Office/DocumentHandling

Reply via email to