Java, C++, C#, Delphi... - Using the UNO bridges
saleem145
Posts: 130 Joined: Mon Jul 02, 2012 4:47 pm
Post
by saleem145 » Mon Aug 06, 2012 1:20 am
Hello,
I am trying the following code --
Code: Select all
startDate = spreadsheet.NamedRanges.getByName("START_DATE").getReferredCells().getValue()
endDate = spreadsheet.NamedRanges.getByName("END_DATE").getReferredCells().getValue()
fields = spreadsheet.NamedRanges.getByName("FIELDS").getReferredCells().getDataArray()
service = CreateUnoService("my_module.MyService1")
service.initializeDataset(start_date, end_date, fields)
The last line is failing. Any suggestions. I have the code working from basic.
Thanks,
Saleem
OpenOffice 3.4.0
Mac OS X 10.5.8
Charlie Young
Volunteer
Posts: 1559 Joined: Fri May 14, 2010 1:07 am
Post
by Charlie Young » Mon Aug 06, 2012 10:10 am
saleem145 wrote: Hello,
I am trying the following code --
Code: Select all
startDate = spreadsheet.NamedRanges.getByName("START_DATE").getReferredCells().getValue()
endDate = spreadsheet.NamedRanges.getByName("END_DATE").getReferredCells().getValue()
fields = spreadsheet.NamedRanges.getByName("FIELDS").getReferredCells().getDataArray()
service = CreateUnoService("my_module.MyService1")
service.initializeDataset(start_date, end_date, fields)
The last line is failing. Any suggestions. I have the code working from basic.
Thanks,
Saleem
createUnoService is a Basic function, not Python. It is equivalent to the ServiceManager's createInstance() method.
Try
Code: Select all
ctx = XSCRIPTCONTEXT.getComponentContext()
oMSF = ctx.getServiceManager()
oMSF.createInstance("some service")
Apache OpenOffice 4.1.1
Windows XP
saleem145
Posts: 130 Joined: Mon Jul 02, 2012 4:47 pm
Post
by saleem145 » Mon Aug 06, 2012 2:40 pm
Hi Charlie,
That's not the issue. I have my own CreateUnoService implemented.
Code: Select all
def CreateUnoService(serviceName):
sm = uno.getComponentContext().ServiceManager
return sm.createInstanceWithContext(serviceName, uno.getComponentContext())
BTW: I got the plotting add-on to work.
Thanks,
Saleem
OpenOffice 3.4.0
Mac OS X 10.5.8
Villeroy
Volunteer
Posts: 31363 Joined: Mon Oct 08, 2007 1:35 am
Location: Germany
Post
by Villeroy » Mon Aug 06, 2012 4:07 pm
Why don't you use an object inspector?
Why don't you split up the long lines?
Code: Select all
onames = spreadsheet.NamedRanges
onamed = onames.getByName("START_DATE")
# this fails if the named has relative parts:
orange = onamed.getReferredCells()
# this fails because a range object has no value:
nval = orange.getValue()
ocell = orange.getCellByPosition(0,0)
nval = ocell.getValue()
Please,
edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
hanya
Volunteer
Posts: 885 Joined: Fri Nov 23, 2007 9:27 am
Location: Japan
Post
by hanya » Mon Aug 06, 2012 5:57 pm
If you ask about your custom or own service, interface, structs or other API implementation, please write its IDL definitions. No one can understand or make answer without it.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04