Apache OpenOffice (AOO) Bugzilla – Issue 51848
HoriOrientPosition is Long in documentation, but it's Integer in the code
Last modified: 2013-02-24 21:07:54 UTC
HoriOrientPosition is supposed to be long, if you look here: http://api.openoffice.org/docs/common/ref/com/sun/star/text/Shape.html#HoriOrientPosition Type[long] HoriOrientPosition (via .getPropertySetInfo()) But actually it's an Integer: System.out.println(xFrameProps.getPropertyValue("HoriOrientPosition").getClass()); => Integer xFrameProps.setPropertyValue("HoriOrientPosition", new Integer(420)); => works xFrameProps.setPropertyValue("HoriOrientPosition", new Long(420)); => com.sun.star.lang.IllegalArgumentException Here is the code snippet: XTextFrame xFrame = (XTextFrame) UnoRuntime.queryInterface ( XTextFrame.class, xMSFDoc.createInstance ( "com.sun.star.text.TextFrame" ) ); XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xFrame); XPropertySet xFrameProps = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xFrame ); xFrameProps.setPropertyValue( "AnchorType", TextContentAnchorType.AT_PAGE ); xFrameProps.setPropertyValue( "HoriOrient", new Short(HoriOrientation.NONE)); System.out.println(xFrameProps.getPropertyValue("HoriOrientPosition").getClass()); xFrameProps.setPropertyValue("HoriOrientPosition", new Integer(420));
The c++ type "Long" is mapped to the java type "Integer", since the java Integer has the same range as a c++ Long ... in c++ you'd have to use a long tho.
closing