OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

PropertyVetoException and IllegalArgumentException[java]

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
satabau
General User
General User


Joined: 12 Mar 2012
Posts: 34

PostPosted: Thu Apr 19, 2012 4:45 am    Post subject: PropertyVetoException and IllegalArgumentException[java] Reply with quote

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
View user's profile Send private message
satabau
General User
General User


Joined: 12 Mar 2012
Posts: 34

PostPosted: Thu Apr 19, 2012 1:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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