[Solved] Launch LibreOffice instead of OpenOffice?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Gudra
Posts: 3
Joined: Thu Apr 05, 2018 10:56 am

[Solved] Launch LibreOffice instead of OpenOffice?

Post by Gudra »

So, I'm writing a program with C# to learn some interaction with the LibreOffice sdk. I installed the 5 cli .dll. I know how to launch OpenOffice using the url

Code: Select all

private:factory/swriter
on a

Code: Select all

loadComponentFromUrl
method, but I haven't found anything on launching LibreOffice with a similar command. Also when I open an existing document, it is opened by default in OpenOffice, and I would prefer to use LibreOffice.

Any help?
Last edited by Gudra on Fri Apr 06, 2018 10:00 am, edited 1 time in total.
OpenOffice 4.1.5 on Windows 7
UnklDonald418
Volunteer
Posts: 1547
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Launch LibreOffice instead of OpenOffice?

Post by UnklDonald418 »

when I open an existing document, it is opened by default in OpenOffice, and I would prefer to use LibreOffice.
Your profile says you are using Windows 7 so try this link
https://www.digitalcitizen.life/how-ass ... ol-program
I haven't tried it but I suspect once you've made the change to the default app your macro will open the document in LO.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Gudra
Posts: 3
Joined: Thu Apr 05, 2018 10:56 am

Re: Launch LibreOffice instead of OpenOffice?

Post by Gudra »

I solved it with some editing on env variables (as the sdk didn't set them, it seems). I wrote this at the begining of my program:

Code: Select all

            var unoPath = @"C:\Program Files\LibreOffice\program";

            Environment.SetEnvironmentVariable("UNO_PATH", unoPath, EnvironmentVariableTarget.Process);
            Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH") + @";" + unoPath, EnvironmentVariableTarget.Process);
OpenOffice 4.1.5 on Windows 7
Post Reply