On 30/03/2009 11:44, 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
hi Vil,
the loadFromMedium/storeToMedium methods of the DocumentProperties service
are _not_ meant to be used for a document that is open in OOo! these are
used if you are _only_ interested in the meta.xml of an ODF file, and not
the content, so you can create your own standalone instance of
DocumentProperties and don't need to load the entire document.
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....
if you use storeToMedium with an open file, then it may write a new
meta.xml into the file, but the loaded document won't care, and will write
its DocumentProperties into the file when you save, overwriting what
storeToMedium wrote.
actually, it's probably a bug that you storeToMedium even works for a file
that is opened.
Any ideas?
Do I have to do something like overwriting the "save" procedure?
you should either:
- work with a loaded document, and only use the DocumentProperties that
you get from the document via getDocumentProperties, and save the entire
document
- work with a document that is not loaded: create a standalone
DocumentProperties instance, and use its loadFromMedium/storeToMedium
don't mix the two!
regards,
michael
--
"I once asked an older coworker and Solaris guru what happened with the
Unix-haters list. He told me that it stopped being quite so funny once
Windows NT came along." -- the gnat on slashdot.org
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]