missed change in uno api since LO5.0?

Winfried Donkers W.Donkers at dci-electronics.nl
Thu Jan 21 04:25:49 PST 2016


Our ERP system uses basic scripts to create Calc documents. This worked fine from the first LO version (3.2?) till 4.4.7, but no longer with LO5.0.

The example below shows the problem.
option explicit

Dim oCalcDoc, oSheet, cURL
Dim oServiceManager, oDesktop, oDispatcher

sub main
 cURL = "file:///c|/temp/test.ods"

  Set oServiceManager = CreateObject("com.sun.star.ServiceManager")
  set oDispatcher     = oServiceManager.createInstance ("com.sun.star.frame.DispatchHelper")
  Set oDesktop = oServiceManager.createInstance ("com.sun.star.frame.Desktop")

  set oCalcDoc = oDesktop.loadComponentFromURL( "private:factory/scalc", "_blank", 0, _
                   Array( makePropertyValue( "Hidden", false ) ) )
  set oSheet = oCalcDoc.getSheets( ).getByIndex( 0 ) ' get the zero'th sheet

  oSheet.getCellByPosition( 1, 1 ).setString( " * test * " )

'all works fine till here
'next line 'does not execute' with LO5.0 and works fine with older versions
  call execDispatch( ".uno:GoToCell", Array( MakePropertyValue( "ToPoint", "$B$3" ) ) )

  set oDesktop        = nothing
  set oServiceManager = nothing
  set oDispatcher     = nothing
end sub 'main

Sub execDispatch(slotName, params())
  call oDispatcher.executeDispatch (oDeskTop.CurrentFrame, slotname, "", 0, params)
End Sub

Public Function MakePropertyValue( cName, uValue )
  Dim oPropertyValue

  set oPropertyValue    = oServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
  oPropertyValue.Name   = cName
  oPropertyValue.Value  = uValue
  set MakePropertyValue = oPropertyValue
End Function

Any clues what needs to be changed to make it work with versions 4 and 5?


More information about the LibreOffice mailing list