After a few more attempts, its seems that:
xMasterPropSet.setPropertyValue("Content", "Toto")
works perfectly fine.
So this is the use of "Name" as a property that is not allowed in
setPropertyValue.
Any hint?
-Etienne
Etienne Gaudrain wrote:
Dear list,
First I hope I am in the right place... Please forgive me and direct
me to the appropriate mailing-list/forum/whatever if I'm off-topic...
I'm trying to develop an application that would interact with
OpenOffice via PyUNO, and I am not able to create a User field. I
started from the Java example here:
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Text/Text_Fields,
and tried to convert it in Python...
Here is my code:
#-------------------------------------
import uno
localContext = uno.getComponentContext()
resolver =
localContext.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver",
localContext )
ctx = resolver.resolve(
"uno:pipe,name=OOo_pipe;urp;StarOffice.ComponentContext" )
smgr = ctx.ServiceManager
desktop = smgr.createInstanceWithContext(
"com.sun.star.frame.Desktop",ctx)
model = desktop.getCurrentComponent()
if model.getImplementationName()=='SwXTextDocument':
xUserField = model.createInstance("com.sun.star.text.TextField.User")
xMasterPropSet =
model.createInstance("com.sun.star.text.FieldMaster.User")
xMasterPropSet.setPropertyValue("Name", "UserEmperor")
ctx.ServiceManager
#-------------------------------------
I get an error "__main__.IllegalArgumentException", on the
xMasterPropSet.setPropertyValue("Name", "UserEmperor") line.
If I run dir(xMasterPropSet), I get all the expected method and
properties, so it just look like the setPropertyValue is either not
the implementation I expected, or that the argument types are wrong?
Can anyone give me a hint on how to do that?
Thanks a lot!.
-Etienne
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Etienne Gaudrain
Centre for the Neural Basis of Hearing
Department of Physiology, Development and Neuroscience
University of Cambridge
Downing Street
Cambridge CB2 3EG
UK
Phone: +44 1223 765 359 office
Fax: +44 1223 333 840 department
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]