Closing instance of OpenOffice?
Posted: Mon Sep 16, 2019 10:38 am
Hi,
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:
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 And being a newbie, I can't find something similar for OpenOffice. Thanks!
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
ServiceManager = New COMObject("com.sun.star.ServiceManager");
Desktop = ServiceManager.createInstance("com.sun.star.frame.Desktop");
Props1 = ServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue");
Props1 .Name = "AsTemplate";
Props1 .Value = True;
Args = New COMSafeArray("VT_VARIANT", 2);
Args.SetValue(0, Props1 );
Props2 = ServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue");
Props2.Name = "Hidden";
Props2.Value = True;
Args.SetValue(1,Props2);
Document = Desktop.LoadComponentFromURL(URL, "_blank", 0, Args);
Sheets = Document.getSheets();
Sheet = Sheets.getByIndex(1); // 2nd sheet of the file
The reason I'm asking is because Excel had something like
Code: Select all
ExcelObj.ActiveWorkbook.Close();