Loading form/report from a DataSource using Java code

asked 2015-05-05 04:31:09 +0200

baongoc gravatar image

updated 2015-09-27 19:48:23 +0200

Alex Kemp gravatar image

Hello everybody.

Currently, I'm digging in OpenOffice and LibreOffice API to write a Java application which will connect to OpenOffice and/or LibreOffice, then execute some tasks. This is my specs:

  • OS: Windows 7 64 Ultimate
  • OpenOffice 4.1.1, OpenOffice SDK 4.1.1
  • Java 1.8.0_45

I'm following this tutorial link but I got error at this line.

XFormsSupplier xSup = (XFormsSupplier)UnoRuntime.queryInterface(XFormsSupplier.class, xDS);

My xSup is null so that I got NullPointerException. Additionally I think XFormsSupplier is wrong. According to the graph in the beginning of the tutorial, it should be XFormDocumentsSupplier. On the other hand, XFormsSupplier doesn't have function getFormDocuments(). That function belongs to XFormDocumentsSupplier. Therefore, I changed XFormsSupplier to XFormDocumentsSupplier but my xSup is still null.

If you have any idea how to do solve this problem, please help me.

Note: my xNameAccess, xDS and con variable are not null so I think they're good. xNameAccess returns "Bibliography" data source and one data source which I created manually.

edit retag flag offensive close merge delete