Jump to content

[CR] LibreOffice Simple LV interface


Recommended Posts

Posted

LibreOffice Simple LV interface


A set of simple VIs that uses the LibreOffice / OpenOffice UNO API. The result is very similar to MS Office ActiveX API. Currently, only Calc is supported. 

 

This was tested on Windows 8 with LV2013 64 bit and LibreOffice 64 bit.

 

 


  • Submitter
  • Submitted
    10/13/2015
  • Category
  • LabVIEW Version
  • License Type

 

  • 1 month later...
Posted (edited)

Just trying the 'Uno_test.vi' example on Labview 2014 / Windows 7 / LibreOffice 5.0.3.2. Having trouble right off with error code 1172 from the 'Bootstrap' invoke node in  'Create Factory' vi. This is being fed with a .net reference set to 'uno.util.Bootstrap'. If I try and create a similar node, I don't get that resource in the drop-down list.

 

Sounds like I haven't installed or set all I need to with LibreOffice. What did you install and set (paths etc) on your computer please?

 

I'm interested in this because I wrote a small test executive that uses Excel for all data storage. I got pretty good creating my own Excel interface and would like to add LibreOffice support to that. I'd attempted to do that via COM but never got it installed right / LibreOffice doesn't support COM - I never fully fathomed that out.

 

Regards, Bob

Edited by Bob W Edwards
Posted

You can browse to the .dll at c:\program files\libreoffice\program\unoidllo.dll.

 

Also, check if both LV and LibreOffice are 32bit or 64bit, if one is different than the other, it will not work.

Posted (edited)

Any luck with LibreOffice 5.0.3.2 ?

 

I'm only use 32 bit Windows for now - I guess that means LibreOffice, the SDK and LabView were all 32 bit.

 

Best regards, Bob

Edited by Bob W Edwards
Posted

I managed to run it on 5.0.3.2

To create the Bootstrap node, click on .Net -> Invoke node -> select class -> .NET -> cli_cppuhelper -> Bootstrap ().

  • 1 year later...
Posted

The current Libreoffice release (5.2.6) has a bug which prevents this library from working. There is fix scheduled for release 5.4 

  • 1 year later...
  • 5 weeks later...
Posted

Hi Gribo,

Thank you very much for this interface. I was looking for something like that for a long time.

However, I get the error 1172 System.Runtime.InteropServices.SEHException when I run your script. This error comes from the Bootsrtap.

I use Labview2018_x64 or Labview2017_x64, LibreOffice_6.0.4.2_x64 and LibreOffice_6.0.4.2_x64_SDK on a Win10_x64 computer.

Do you have any idea where does this error come from and how to fix it?

I set the environment variables:

OFFICE_PROGRAM_PATH = C:\Program Files\LibreOffice\program

UNO_PATH = C:\Program Files\LibreOffice

 

Thank you!

Posted (edited)

I don't have access to LV2017. This error usually means that it can't find the Uno DLLs. IIRC, The UNO path should point to C:\Program Files\LibreOffice\program

Edit: The UNO_PATH variable is case sensitive. Make sure it has the exact case as above.

Edited by Gribo
  • 3 weeks later...
Posted

Hi Gribo,

 

I finally managed to get it work by setting the correct UNO_PATH + computer reboot!!

Thank yo very much for all your work done on that subject and for sharing it with the community. It helps a lot, saving precious time...

 

All the best!

  • 5 months later...
Posted (edited)

Any tips on what I should research/learn to understand how I can add a chart through LabVIEW?

I was able to get all VIs working in both LV 2015 32bit and LV 2018 64bit using version 6.0 Libreoffice.

I'm at the point of developing the library more but not sure where to start.

Thanks!

David

Edited by David C. Li
Posted

It is a matter of finding the right API calls in the LibreOffice API and using them.

For charts, I think the easiest method would be to add a chart sheet and playing with its parameters.

  • Thanks 1
Posted (edited)

Hi Gribo,

Thanks for the guidance!

On that website, I followed this example: https://api.libreoffice.org/examples/DevelopersGuide/Charts/CalcHelper.java under the Charts Example section.

They casted a specific XSpreadsheet to a XTableChartsSupplier.class. Then used the getCharts() method to return a collection of charts and then used the addNewByName method to add  a new chart to that collection with the arguments (sChartName, aRect, aAddresses, true, false)

 

I was able to create the charts and embedded it into the specific spreadsheet but they defaulted to bar charts.

After the charts are created I was planning on formatting them to a different chart type, and also adding titles, axis names etc.. What do you think about this method? Any downsides?

 

Also let me know if my understanding or terminology is flawed. I haven't programmed in Java in years, and I do not fully understand the API yet.

Thanks!

David

Edited by David C. Li
Posted

I understand the API even less, as I have never programmed in Java. I played with it for a bit, but could not get it to create a chart document. Since this is not a high performance library, what ever gets the results is good. 😀

  • Like 1
Posted

Yeah, the VI I'm building is sort of a one-off solution. So it's a little messy but it does the job.

For future viewers of this thread. This is a good resource:

https://fivedots.coe.psu.ac.th/~ad/jlop/#calc

And the author has a chapter on the chart2 api here:

https://fivedots.coe.psu.ac.th/~ad/jlop/chaps/28. Chart2 API Overview.pdf

 

Thanks again for the prompt responses Gribo, I wouldn't have expected it for a thread from 2015 haha

If i ever clean up my library I'll add some examples to this thread.

Cheers!

David

Posted

After playing a bit with LabVIEW, and remembering to cast a value, and not its class, I managed to get to your level. I will post an update in an hour or so.

  • Like 1
Posted

I have uploaded a new version. The test VI now creates a chart with random data. 

LibreOffice 6 is way faster than 5, it feels as fast as the Excel .NET API.

  • 3 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.