Closing instance of OpenOffice?

Creating a macro - Writing a Script - Using the API

Closing instance of OpenOffice?

Postby t_t_u » Mon Sep 16, 2019 10:38 am


I've got a task to migrate my piece of application from MS Excel to OpenOffice. My code creates a COM object of the OO application, gets a specified Calc sheet and retrieves data from it in the following way:

Code: Select all   Expand viewCollapse view
ServiceManager = New COMObject("");
Desktop = ServiceManager.createInstance("");
Props1 = ServiceManager.Bridge_GetStruct("");
Props1 .Name = "AsTemplate";
Props1 .Value = True;
Args = New COMSafeArray("VT_VARIANT", 2);
Args.SetValue(0, Props1 );
Props2 = ServiceManager.Bridge_GetStruct("");
Props2.Name = "Hidden";
Props2.Value = True;
Document = Desktop.LoadComponentFromURL(URL, "_blank", 0, Args);
Sheets = Document.getSheets();
Sheet = Sheets.getByIndex(1); // 2nd sheet of the file

My question is do I need to close/destroy created instance when my code has finished working with OO?

The reason I'm asking is because Excel had something like
Code: Select all   Expand viewCollapse view
And being a newbie, I can't find something similar for OpenOffice. Thanks!
OpenOffice 4.1.6
Posts: 1
Joined: Mon Sep 16, 2019 10:29 am

Re: Closing instance of OpenOffice?

Postby robleyd » Mon Sep 16, 2019 11:41 am

You might find some useful information from a forum search for close window in the Macros and API section; in particular [Solved] Close OOo from a macro might be helpful
Apache OpenOffice 420m2(Build:9821) - Slackware 14.2 - 64 bit
LibreOffice - Slackware 14.2 - 64 bit
Apache OpenOffice 4.1.4 - Windows 7 Virtual machine
User avatar
Posts: 3515
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 11 guests