Dear Forumers,
I have trouble to understand how working on opened ods file works.
I want to save actual file as another, then open it as hidden and copy sheet inside this file.
The problem is that component method copyByName doesn’t work due to “No method found”.
Other methods look working.
When I am using ThisComponent.copyByName - it is working.
Test code to show a problem below. Thanks!
Sub Main
GlobalScope.BasicLibraries.loadLibrary("Tools")
oView = ThisComponent.getCurrentController()
oSheets = ThisComponent.getSheets()
oSheet = ThisComponent.Sheets.GetByName("names")
sSaveToURL = DirectoryNameoutofPath(ThisComponent.getURL(),"/") & "/test.ods"
thisComponent.storeToUrl(sSaveToURL, Array())
' output document file parameters
Dim Props(0) As New com.sun.star.beans.PropertyValue
Props(0).Name = "Hidden"
Props(0).Value = True
' load output document file
oDest = StarDesktop.loadComponentFromURL(sSaveToURL, "_blank", 0, Props()) ' "default", 0, args())
oPattern1 = oDest.Sheets.GetByName("pattern_1")
oDest.copyByName(oPattern1.Name, "New name sheet", oDest.Sheets.Count) 'ERROR HERE
oDest.store()
oDest.close(True)
End sub