Fwd: Re: Ask for help, Young developer request

Bartłomiej Mikos PrimeSoft Polska bartlomiej.mikos at primesoft.pl
Wed Feb 25 00:46:50 PST 2015


Good morning,

I solved the problem. I thougth than UpdateDocMode.NEVER_UPDATE will set 
up loading without warning. It is not true, the problem solved set libre 
office by hand in options -> set update document from on request to 
never update. It solving the problem. I thinking now why UpdateDocMode 
property not working and how set Never Update documents from code (its 
not good idea to setting libre office conf by hand :D).

However, thanks for help. If You will have fast answer for no update by 
code, it will be glad to read good tip.

Have a nice day,
Bartłomiej Mikos

--- Treść przekazanej wiadomości ---
Temat: 	Re: Ask for help, Young developer request
Data: 	Mon, 23 Feb 2015 08:35:30 +0100
Nadawca: 	Bartłomiej Mikos PrimeSoft Polska <bartlomiej.mikos at primesoft.pl>
Adresat: 	Andrew Pitonyak <andrew at pitonyak.org>



Good Morning,

I tried use XModifiable to close xlsx file, my method for making pdf 
looks like that:

     public void convertToPdf(String sourcePath, String destinyPath)
             throws java.lang.Exception {

         PropertyValue[] properties = new PropertyValue[3];

         properties[0] = getHiddenProperty();

         properties[1] = new PropertyValue();
         properties[1].Name = "UpdateDocMode";
         properties[1].Value = new Short((short) 1);

         properties[2] = new PropertyValue();
         properties[2].Name = "ReadOnly";
         properties[2].Value = new Boolean(true);

         String sourceURL = convertFilePathToURL(sourcePath);
         String destinyURL = convertFilePathToURL(destinyPath);

         XComponent xComponent = xComponentLoader.loadComponentFromURL(
                 sourceURL, "_blank", 0, properties);

         XModel xModel = UnoRuntime.queryInterface(XModel.class, 
xComponent);

         XModifiable xModifiable = 
UnoRuntime.queryInterface(XModifiable.class,
                 xModel);

         xModifiable.setModified(false);

         XStorable xStorable = null;
         if (xComponent != null) {
             xStorable = UnoRuntime.queryInterface(XStorable.class, 
xComponent);

             if (xStorable != null) {
                 properties = new PropertyValue[2];
                 properties[0] = getPDFWriterProperty();
                 properties[1] = new PropertyValue();
                 properties[1].Name = "Wait";
                 properties[1].Value = new Boolean(true);

                 xStorable.storeToURL(destinyURL, properties);
             }
         }

         //I tried use XModifiable here too

         if (xStorable != null) {
             XCloseable closeable = 
UnoRuntime.queryInterface(XCloseable.class,
                     xStorable);
             if (closeable != null) {
                 try {
                     closeable.close(true);
                 } catch (CloseVetoException closeVetoException) {
                    //exception problem
                 }
             } else {
                 XComponent xComp = 
UnoRuntime.queryInterface(XComponent.class,
                         xStorable);
                 xComp.dispose();
             }
         }
     }

It not helps with that issue. Maybe usefull information is that I used 
UpdateDocMode (all options) and there still appears warn window 
"update/links [yes][no]". Have You some other tips which can help?.

Thanks you for Your interest,
Have a nice day.

W dniu 2015-02-20 o 14:35, Andrew Pitonyak pisze:
> First use XModifiable and if
> "isModified" is true call
> "setModified" to set to false.
>
> See of that helps.
>
> On Feb 20, 2015 3:12 AM, =?UTF-8?Q?Bart=C5=82omiej_Mikos_PrimeSoft_Polska?=<bartlomiej.mikos at primesoft.pl>  wrote:
>> Good Morning,
>>
>> I have problem with use of java LibreOffice Api 4.3
>>
>> Is a possible way to close XComponent (xlsx type) in save way?.
>>
>> I have converting to pdf method. I use XStorable.storeToURL() The
>> converting works fine, but when I try to close like this:
>>
>>           if (xStorable != null) {
>>               XCloseable closeable =
>> UnoRuntime.queryInterface(XCloseable.class, xStorable);
>>               if (closeable != null) {
>>                   try {
>>                       closeable.close(true);
>>                   } catch (CloseVetoException closeVetoException) {
>>                       //problem with xlsx files, always occure
>>                   }
>>               } else {
>>                   XComponent xComp =
>> UnoRuntime.queryInterface(XComponent.class, xStorable);
>>                   xComp.dispose();
>>               }
>>           }
>>
>> I tried to dispose a XController and the XFrame. In that case window is
>> closed, but in next time XComponentLoader cannot load the XComponent,
>> problem with socket etc.
>>
>> Can You tell me what i should do to make it work fine?. Maybe i should
>> know more about something or You had some simillar problems?.
>>
>> I hope You will find time to answer,
>> Have a nice day.
>>
>>
>> _______________________________________________
>> LibreOffice mailing list
>> LibreOffice at lists.freedesktop.org  
>> http://lists.freedesktop.org/mailman/listinfo/libreoffice  

Z poważaniem,
Bartłomiej Mikos
--
Bartłomiej Mikos
software engineer
bartlomiej.mikos at primesoft.pl <mailto:bartlomiej.mikos at primesoft.pl>
www.primesoft.pl <http://www.primesoft.pl>

PrimeSoft Polska Sp. z o.o.
ul. Perkuna 25, 61-615 Poznań tel/fax 61/833-17-72
NIP 7831592998 Regon 634610845 KRS 0000221565 Kapitał zakł. 50000pln
NORDEA Bank Polska S.A. PL 50 1440 1130 0000 0000 0336 0806

*Dla Państwa już od 10 lat*
Dnia 25 września 2014 roku odbyła się konferencja "10-lecie PrimeSoft 
Polska: okiem klienta, okiem dostawcy – wymiana doświadczeń 
biznesowych". W wydarzeniu wzięli udział przedstawiciele firm i 
instytucji będących klientami oraz partnerami biznesowymi PrimeSoft 
Polska. Relacja z wydarzenia <http://www.youtube.com/watch?v=FjsrjSmaNaQ>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20150225/296489e2/attachment.html>


More information about the LibreOffice mailing list