Using XStorable Interface on New Document

Discussions about using 3rd party extension with

Using XStorable Interface on New Document

Postby Niklas.Ardey » Tue Feb 09, 2016 12:04 pm


I have a question (well thats quiet obvious when i am here :D)

I am trying to use the XStorable interface on the Document that is currently open in Open Office Writer. The Document was never before saved and I only want to save it in the Temp folder of the Users Pc cause i only need the Document to Convert it into a Byte[] that I can send to our server.
This is what I tried but I realy dont know how I can get it to work:
Code: Select all   Expand viewCollapse view
                XModel xDocModel = this.frame.getController().getModel();

                XTextDocument xtextdocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xDocModel);
                XStorable xStorable = (XStorable) UnoRuntime.queryInterface(XStorable.class, xtextdocument);
                PropertyValue[] storeProbs = new PropertyValue[1];
                xStorable.storeAsURL("C:\\Windows\\Temp\\Test.odt", storeProbs);

Maybe you have a step by step Tutorial or you can provide anything else that may Help me.

BTW I am using Java and Netbeans to programm it.
OpenOffice 4.1.1 same with the SDK
Operation System is Windows 8.1
Posts: 56
Joined: Mon Oct 19, 2015 2:34 pm

Re: Using XStorable Interface on New Document

Postby B Marcelly » Tue Feb 09, 2016 3:00 pm

Your question has no relation to an extension, but to programming OpenOffice in Java. It should have been posted either in Macros and UNO API or one of its sub-sections.

Storing a document is basic knowledge in OpenOffice programming. The reference, especially for Java programming, is of course the Developer's Guide : Storing Documents.

The last instruction of your code uses method storeAsURL(). As the name implies, it needs an URL as argument.
Bernard 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
B Marcelly
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Return to Extensions

Who is online

Users browsing this forum: No registered users and 2 guests