Quoting Mathias Bauer <[email protected]>:
Benjamin Vollmer wrote:
Hello,
I work on an extension where in some cases the opened document is
updated externally. So I have to reload my document.
In a snippet I found this way:
PropertyValue[] aLoadProps = new PropertyValue[0];
// reload current document
xComponentLoader.loadComponentFromURL(this.xFrame.getController().getModel().getURL(),
"_self", 0, aLoadProps);
But in my context this snippet doesn't work. Under Ubuntu nothing
happens when the code is executed, under Windows there occurs an UNO
Runtime Error. At the moment I reload the file manually over File ->
Reload. This works but it is not really a solution.
What is the right way to reload a document via API?
You can use the Dispatch API to achieve that. The command you have to
dispatch at the documents' frame is ".uno:Reload".
Unfortunately the solution with ".uno:Reload" does not work anymore
since OO.org 3.1 was released. Under Windows I cannot update the
opened document externally because it is locked. I need a workaround
with close and then reopen the document. Is there also a Dispatch API
command for close? I found ".uno:CloseDoc", but it doesn't work as
aspected. Nothing happens when I use ".uno:CloseDoc" instead of
".uno:Reload".
I also found the interface xClosable
(http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Closing_Documents#XCloseable), but I had no success with the usage. Under Ubuntu OpenOffice crashes with the sample code, under Windows the code closes the document but also all other visible OpenOffice
components.
regards
Benjamin
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]