PropertyVetoException e IllegalArgumentException[java]

Non sapete dove scrivere? Scrivete qui!
Regole del forum
Solo richieste di aiuto. Per saluti e presentazioni utilizzate il forum Discussioni Generali e Presentazioni.
Rispondi
andrewbale
Messaggi: 11
Iscritto il: mercoledì 18 aprile 2012, 20:28

PropertyVetoException e IllegalArgumentException[java]

Messaggio da andrewbale »

Sto cercando di copiare i commenti di una cella di un foglio di calcolo in un'altra cella così:

Codice: Seleziona tutto


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();

//Metodo che copia le proprietà
copyProps(xShape,xShape2);
E questo è il metodo che copia:

Codice: Seleziona tutto

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();
                }
            }       
        }
}
Per alcune proprietà ho delle eccezioni(la stampa nel catch):

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

Ho quindi 13 eccezioni su 185 proprietà
Potete aiutarmi? Non capisco perchè mi si presentano le eccezioni, sto solo copiando proprietà di un commento...
Grazie
OpenOffice 4 su Windows 7