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