Strange behavior when setting custom property!

R

Roland Leisch

Hello!

I have the follwing problem: Im using a Java-COM Bridge and I try to add
a custom property to a document (which is in an OLE container) and set a
value for this property:

Variant result = propertiesAutomation.invoke("add", new Object[]{
new Integer(100), //Value = 100
Variant.createUnspecifiedParameter(),
new Integer(5), //Datatype 5 for Integer
new Boolean(true), //LinkToContent
"testproperty"}); //name of property

The problem is that the property is created, but the value is "0.0". If
I try to change the value later via setproperty method I get an
0x80020009; DISP_E_EXCEPTION!

I have tried all values for datatype and different values but every time
I get the same result.

Im using a Java-COM Bridge to invoke Methods and Microsoft Office XP (in
this codesample for Word XP).

Can anyone be so kind and help me?

best regards
 
R

Roland Leisch

Roland said:
Hello!

I have the follwing problem: Im using a Java-COM Bridge and I try to add
a custom property to a document (which is in an OLE container) and set a
value for this property:

Variant result = propertiesAutomation.invoke("add", new Object[]{
new Integer(100), //Value = 100
Variant.createUnspecifiedParameter(),
new Integer(5), //Datatype 5 for Integer
new Boolean(true), //LinkToContent
"testproperty"}); //name of property

The problem is that the property is created, but the value is "0.0". If
I try to change the value later via setproperty method I get an
0x80020009; DISP_E_EXCEPTION!

I have tried all values for datatype and different values but every time
I get the same result.

Im using a Java-COM Bridge to invoke Methods and Microsoft Office XP (in
this codesample for Word XP).

Can anyone be so kind and help me?

best regards

I found the problem: the parameter list is inverted with this kind of
method call:

Variant result = propertiesAutomation.invoke("add", new Object[]{
Variant.createUnspecifiedParameter(), //LinkToSource
new Variant(100), //Value
new Variant(4), //Datatype 1-number, 2-Boolean, 3-Date,
4-String, 5-Float
new Variant(false), //LinkToContent
new Variant("m2n uri") //Name der Property
});
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top