Ask Your Question

Exporting a calc with MACRO XSpreadsheetComponent returns NULL [closed]

asked 2013-09-24 10:45:30 +0100

Sugam Varshney gravatar image

updated 2015-08-27 14:05:55 +0100

Alex Kemp gravatar image

We have been using the OpenOffice APIs to import and export the sheet documents, Just tried to adopt LibraOffice. The control is giving the error at the creation of the XSpreadsheetComponent, The code flow has these lines

        loadProps[0]        = new PropertyValue();
        loadProps[0].Name   = "Hidden";
        loadProps[0].Value  = Boolean.TRUE;

        loadProps[1]         = new PropertyValue();
        loadProps[1].Name    = "InputStream";                                                   
        loadProps[1].Value  = oois;

        synchronized (xComponentLoader)
            xSpreadsheetComponent = xComponentLoader.loadComponentFromURL("private:stream", "_blank", 0, loadProps);

If i changes the port no to 8000(Thats where I am running java), the xSpreadsheetComponent generated but then it gives same nullpointerexception when I tries to get XSpreadsheetDocument.

XSpreadsheetDocument xDocument = (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent);

The sheet export just fine when there is no MACRO in it. Only after creating/recording macros it gives these errors. The export doesn't make any different even after the deleting the created MACRO, The xSpreadsheetComponent returns null.

Is there some difference in OO and LibreOffice APIs?

Thanks in Advance.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2015-11-10 06:53:47.615330

1 Answer

Sort by » oldest newest most voted

answered 2013-09-30 09:26:51 +0100

Sugam Varshney gravatar image

updated 2013-09-30 09:30:10 +0100

oweng gravatar image

I did some research and analysis and found out that my manifest.xml did not have manifest:full-path of Macro.xml. It started to work when I add the manifest:full-path of there three remaining xmls.

<manifest:file-entry manifest:media-type="text/xml" manifest:full-path="Basic/Standard/MyMacro.xml"/>
<manifest:file-entry manifest:media-type="text/xml" manifest:full-path="Basic/Standard/script-lb.xml"/>
<manifest:file-entry manifest:media-type="text/xml" manifest:full-path="Basic/script-lc.xml"/>

Is there a change in reading them in LibraOffice? As files were not giving any error even without these lines when I was using OpenOffice. Do I have to make these changes in manifest.xml?

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-09-24 10:45:30 +0100

Seen: 532 times

Last updated: Sep 30 '13