Using XStorable Interface on New Document

Discussions about using 3rd party extension with OpenOffice.org
Post Reply
Niklas.Ardey
Posts: 56
Joined: Mon Oct 19, 2015 2:34 pm

Using XStorable Interface on New Document

Post by Niklas.Ardey »

Hello,

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

                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
B Marcelly
Volunteer
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Re: Using XStorable Interface on New Document

Post by B Marcelly »

Hi,
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

OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
Post Reply