incubator-ooo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "F C. Costero" <fjcc.apa...@gmail.com>
Subject Re: Executing UNO Dispatcher in VBScript doesn't reflect any changes in ODS file
Date Mon, 05 Mar 2012 15:16:18 GMT
I also don't see the Name and Value properties of the Property value
being set in the function. Try
Function MakePropertyValue(oServiceManager, cName, uValue)
  Dim oStruct
  Set oStruct =
oServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
  oStruct.Name = cName
  oStruct.Value = uValue
  Set MakePropertyValue = oStruct
End Function

On Mon, Mar 5, 2012 at 7:18 AM, TJ Frazier <tjfrazier@cfl.rr.com> wrote:
> Try adding a Store request:
>
>> Call UnoObj.executeDispatch(document, ".uno:BackgroundColor", "", 0,
>> propertyset)
> oSpreadsheet.Store()
>> oSpreadsheet.Close(True)
> Close won't do that for you.
> /tj/
>
>
> On 3/5/2012 05:10, Subodh Asthana wrote:
>>
>> 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
View raw message