Date: prev next · Thread: first prev next last
2016 Archives by date, by thread · List index


Hi,

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?

Winfried


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.