incubator-ooo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Subodh Asthana <asthana.sub...@gmail.com>
Subject Executing UNO Dispatcher in VBScript doesn't reflect any changes in ODS file
Date Mon, 05 Mar 2012 10:10:55 GMT
Executing UNO Dispatcher in VBScript doesn't reflect any changes in ODS file
http://stackoverflow.com/q/9562093/264668?sem=2

Following is the code that I wrote to try formatting ODS using VBSript. It
runs without any error but it *does not reflect any change* in the ODS file.

Dim propertyset(0)
Dim arg()
Set oServiceManager = CreateObject("com.sun.star.ServiceManager")
Set oDesktop = oServiceManager.createInstance("com.sun.star.frame.Desktop")
Set UnoObj = oServiceManager.createInstance("com.sun.star.frame.DispatchHelper")
sFileName = "D:\Untitled 1.ods"
sFileName = Replace (sFileName, "\", "/")
sURL = "file:///" & sFileName
Set oSpreadsheet = oDesktop.loadComponentFromURL(sURL, "_blank", 0,
arg)    'load existing spreadsheet

set oSheet1 = oSpreadsheet.getSheets.getByName( "Sheet1" )
set document   = oSpreadsheet.CurrentController.Frame

Set propertyset(0) = MakePropertyValue(oServiceManager, "ToPoint", "$A$1")
Call UnoObj.executeDispatch(document, ".uno:GoToCell", "", 0, propertyset)

Set propertyset(0) = MakePropertyValue(oServiceManager,
"BackgroundColor", 16711680)
Call UnoObj.executeDispatch(document, ".uno:BackgroundColor", "", 0,
propertyset)
oSpreadsheet.Close(True)
set UnoObj = Nothing
set oSpreadsheet = Nothing
set oDesktop = Nothing
set oServiceManager = Nothing

Function MakePropertyValue(oServiceManager, cName, uValue)
   Dim oStruct
   Set oStruct =
oServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
   Set MakePropertyValue = oStruct
End Function

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message