| View previous topic :: View next topic |
| Author |
Message |
satabau General User

Joined: 12 Mar 2012 Posts: 34
|
Posted: Thu Apr 19, 2012 4:45 am Post subject: PropertyVetoException and IllegalArgumentException[java] |
|
|
i'm trying to copy a cell annotation to another cell in this way
| Code: |
XSheetAnnotationAnchor anchor = (XSheetAnnotationAnchor)
UnoRuntime.queryInterface(XSheetAnnotationAnchor.class, xCell);
XSheetAnnotation xAnnot = anchor.getAnnotation();
XSheetAnnotationAnchor anchor2 = (XSheetAnnotationAnchor)
UnoRuntime.queryInterface(XSheetAnnotationAnchor.class, xCell2);
XSheetAnnotation xAnnot2 = anchor2.getAnnotation();
XSheetAnnotationShapeSupplier xSheetAnnotationShapeSupplier =
(XSheetAnnotationShapeSupplier) UnoRuntime.queryInterface(XSheetAnnotationShapeSupplier.class,
xAnnot);
XSheetAnnotationShapeSupplier xSheetAnnotationShapeSupplier2 =
(XSheetAnnotationShapeSupplier) UnoRuntime.queryInterface(XSheetAnnotationShapeSupplier.class,
xAnnot2);
XShape xShape = xSheetAnnotationShapeSupplier.getAnnotationShape();
XShape xShape2 = xSheetAnnotationShapeSupplier2.getAnnotationShape();
//Method that copies the properties
copyProps(xShape,xShape2);
|
And here is the method CopyProps
| Code: |
private static void copyProps(Object xSource, Object xTarget) throws Exception
{
int i = 0;
XPropertySet srcProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xSource);
XPropertySet tgtProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTarget);
Property[] srcPropList = srcProps.getPropertySetInfo().getProperties();
for (; i < srcPropList.length; i++)
{
Object obj = srcProps.getPropertyValue(srcPropList[i].Name);
if (obj != null)
{
try{ tgtProps.setPropertyValue(srcPropList[i].Name, obj);
}
catch(Exception e)
{
System.out.println(srcPropList[i].Name); e.printStackTrace();}
}
}
}
} |
For some properties I have exception:
1)MetaFile
com.sun.star.beans.PropertyVetoException
2)IsFontwork
com.sun.star.beans.PropertyVetoException
3)LinkDisplayBitmap
com.sun.star.beans.PropertyVetoException
4)FillGradientName
com.sun.star.lang.IllegalArgumentException
5)LineDashName
com.sun.star.lang.IllegalArgumentException
6)UINamePlural
com.sun.star.beans.PropertyVetoException
7)FillHatchName
com.sun.star.lang.IllegalArgumentException
8)LinkDisplayName
com.sun.star.beans.PropertyVetoException
9)Bitmap
com.sun.star.beans.PropertyVetoException
10)FillBitmapName
com.sun.star.lang.IllegalArgumentException
11)UINameSingular
com.sun.star.beans.PropertyVetoException
12)BoundRect
com.sun.star.beans.PropertyVetoException
13)ShearAngle
com.sun.star.lang.IllegalArgumentException
I have 13 exception on 185 properties.
Can you help me please. I don't understand why, I'm just copying the properties...
Thank you |
|
| Back to top |
|
 |
satabau General User

Joined: 12 Mar 2012 Posts: 34
|
Posted: Thu Apr 19, 2012 1:33 pm Post subject: |
|
|
Ok, the PropertyVetoExceptions were about the fact that the properties was READONLY.
But I still have the IllegalArgumentExceptions for:
FillGradientName
LineDashName
FillHatchName
FillBitmapName
ShearAngle
Ideas?
The annotation on the source cell is Bold, Underline and Italic but, maybe due to these exceptions, in the other is only bold and italic... |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|