Migrating from OOO Calc to LO Calc | SDK, UNO, Officebean, Plugin

libreoffice.ge at gmail.com libreoffice.ge at gmail.com
Tue Mar 6 23:46:06 PST 2012


Dear Michael,

Many thanks for quick response.
See our answers in green.

Best Regards
[Nick] & Team


On 3/6/2012 7:38 PM, Michael Meeks wrote:
> Hi there,
>
> On Tue, 2012-03-06 at 19:23 +0400, libreoffice.ge at gmail.com wrote:
>> We are working on   Open source Project   where OOO Calc  was used
>> for report designer.  Now we are going to migrate  from OOO calc to LO
>> Calc and need your help with following:
> 	Great - where is your source code out of interest ? :-)
[Nick]
Old code hosted on Sourceforge CVS can be found here: 
http://fina.cvs.sourceforge.net/viewvc/fina
Code related with OOO addin  is here: 
http://fina.cvs.sourceforge.net/viewvc/fina/addin/
Old project is here: http://sourceforge.net/projects/fina

New code hosted on Atlasian  SVN  is here: 
https://fina2net.atlassian.net/svn/FINA/trunk ( current version is 0.2)
New Project is here: jira.fina2.net

>> 1.       We are using OOO SDK 2.1   to register Calc Add in.
>> ·         Was new LO SDK changed significantly?
> 	It should not have been. One thing to bear in mind is that our xcu
> (configuration data) parser is a lot stricter, so you need well formed
> XML that matches the schema (which was not true in older versions). But
> if you get that right things should be ok I hope.
[Nick]
Do you think we need to rewrite the code? Or XML configuration / 
customization will be enough?

>> ·         Where is a docs we need to read before development?
> 	Assume that the docs are the same as before I guess, but they are here:
>
> 	http://api.libreoffice.org/
>
> 	bug reports / patches to the docs much appreciated.
[Nick] Thanks.
>> 2.       We have used OOOBean [officebean.jar]   for opening OOO Calc
>> in Java Environment . Are you planning to develop officebean  project?
>> Where can we find docs and/or wiki materials?
> 	The bean should still exist, is still packaged, etc. There are a few
> reports of problems with it, again fixes appreciated for that.
[Nick] Thanks. Can we generate HTML file without opening OOO (LO).

Right now (in old version) we are using the method  - please see here:  
https://fina2net.atlassian.net/source/browse/FINA/trunk/fina/fina-server/src/main/java/net/fina/server/ooo/OOSheet.java?hb=true 

(or see code below). Connection with OOO takes allot of time: 2-3 sec.


>> 3.       One of the option we have is to use Libreoffice.org Calc
>> Plugin connected to JBoss through web services (like this project).
>>    Could you please give us links on similar projects or “how to” doc?
> 	Not that clear what you want, you want mail-merge ? if so, you'd want
> to provide something that looked like a database I suppose to provide
> that.

[Nick]

*We would like to write an extension for LO which will exchange data 
with web services.We are planning to link it with JBoss.  Will send you 
more infomration and screenshot on what we are discussing.*


>> 4.        UNO Interface  - was it significantly changed?
> 	In a nutshell we should be backwards compatible with OpenOffice.org -
> at least, this is what we try to be. Of course, there are always bugs we
> need to find out :-)
>
> 	Hope that helps !
>
> 		Michael.
>


CODE HOW TO SAVE OOO to HTML
  public byte[] exportAsHtml(byte[] tempReportContent) {
                 byte[] htmlContent = null;

                 try {
                         log.info("Exporting As Html");

                         XStorable xStorable = null;

                         Object desktop = null;
                         XComponent document = null;

                         xRemoteContext = getRemoteContext();

                         xRemoteServiceManager = 
xRemoteContext.getServiceManager();

                         // Get a desktop instance
                         desktop = 
xRemoteServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", 
xRemoteContext);

                         // Get a reference to the desktop interface 
that can load files
                         XComponentLoader loader = (XComponentLoader) 
UnoRuntime.queryInterface(XComponentLoader.class, desktop);

                         XInputStream xStream = new 
ByteArrayToXInputStreamAdapter(tempReportContent);

                         PropertyValue[] args = new PropertyValue[2];

                         args[0] = new PropertyValue();
                         args[0].Name = "InputStream";
                         args[0].Value = xStream;
                         args[0].State = PropertyState.DIRECT_VALUE;

                         args[1] = new PropertyValue();
                         args[1].Name = "Hidden";
                         args[1].Value = new Boolean(true);

                         document = 
loader.loadComponentFromURL("private:stream", "_blank", 0, args);

                         ByteArrayOutputStream out = new 
ByteArrayOutputStream();

                         XOutputStream xOut = new 
OutputStreamToXOutputStreamAdapter(out);

                         PropertyValue[] args1 = new PropertyValue[2];

                         args1[0] = new PropertyValue();
                         args1[0].Name = "OutputStream";
                         args1[0].Value = xOut;
                         args1[0].State = PropertyState.DIRECT_VALUE;

                         args1[1] = new PropertyValue();
                         args1[1].Name = "FilterName";
                         args1[1].Value = "HTML (StarCalc)";

                         xStorable = (XStorable) 
UnoRuntime.queryInterface(XStorable.class, document);
                         xStorable.storeAsURL("private:stream", args1);

                         xOut.flush();

                         htmlContent = out.toByteArray();

                         xOut.closeOutput();
                 } catch (Exception ex) {

                         log.error(ex.getMessage(), ex);
                 }
                 return htmlContent;
         }


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120307/c4fef234/attachment-0001.html>


More information about the LibreOffice mailing list