Hi,

Vil wrote:
Hi,

I got a little problem.

I got an open Writer document and by clicking on a menu-item (my add-on) I
am adding some userDefinedProperties and storing them to the current file by
calling "storeToMedium".
After that I am now able to retrieve them again by calling "loadFromMedium"
(and passing the current documents filepath as a parameter).
This all works fine.
--> I can find the userdefindeproperties in the documents meta.xml

BUT if I am adding and storing userdefinedproperies AND click in "File
->Save" I am no longer able to retrieve / load the user defined properties.
--> The entries in the meta.xml disappeared.

It seems that the "save" - Process rewrites the whole meta.xml and therefore
drops the udp....

Any ideas?
Do I have to do something like overwriting the "save" procedure?
do you use the XDocumentProperties(Supplier) as Mathias mentioned? If yes it sounds like a bug and you should submit an issue.

Ideally with a bug doc containing a short macro to create and store some user props etc.

Juergen



Mathias Bauer wrote:
Hi,

the XDocumentInfo(Supplier) API has a design flaw and so we have
deprecated it in 3.0. For new code it is recommended to use
XDocumentProperties(Supplier) instead.

Regards,
Mathias

Fernand Vanrie wrote:

giancarlo

yep somethin like:
           oDocinfo = thiscomponent.documentinfo

    if not oDocInfo.PropertySetInfo.HasPropertyByName("My property"")
then
              oDocInfo.AddProperty("My property"",0,Myvalue
          else
                oDocInfo.setPropertyValue("My property"" , Myvalue
          endif

hope it helps,

Fernand


wrote:
ye! solved with this:

           XMultiComponentFactory xmcf = m_xContext.getServiceManager();
           Object desktop =
xmcf.createInstanceWithContext("com.sun.star.frame.Desktop",
m_xContext);
           XDesktop xDesktop = (XDesktop)
UnoRuntime.queryInterface(XDesktop.class, desktop);
           XComponent xCurrentComponent =
xDesktop.getCurrentComponent();
           XDocumentInfoSupplier xDocumentInfoSupplier =
(XDocumentInfoSupplier)
UnoRuntime.queryInterface(XDocumentInfoSupplier.class,
xCurrentComponent);
           XDocumentInfo xDocumentInfo =
xDocumentInfoSupplier.getDocumentInfo();
           XPropertySet xDocumentPropertySet = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xDocumentInfo);
           System.out.println("My property" +
xDocumentPropertySet.getPropertyValue("property_name"));

emh... and is the way to set document infos similar to this?

Fernand Vanrie wrote:
giancarlo

do not match in Java but in basic:

thiscomponent.documentinfo.propertyvalues(0).name  or

thiscomponent.documentinfo.getpropertyvalue(" the name")


a user defined property is a property of the documentinfo and can
been accesed by index or by name

hop it helps

Fernand

gives yo
wrote:

How can I get the user defined properties from an ooo file using the
java ooo sdk??
I've been trying and trying with no success :(





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


--
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
Please don't reply to "[email protected]".
I use it for the OOo lists and only rarely read other mails sent to it.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]






---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to