Hello again. I trying to change height, width and margins of opened
document.
I have this code, but in's not working:
================ cut ==================
...
// it works
xComponentLoader =
(com.sun.star.frame.XComponentLoader)UnoRuntime.queryInterface(com.sun.star.frame.XComponentLoader.class,
xDesktop);
xComponent = xComponentLoader.loadComponentFromURL(sourceFile, "_blank", 0,
openProperties);
com.sun.star.beans.XPropertySet xPageProperties =
(com.sun.star.beans.XPropertySet) UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xComponent );
try {
xPageProperties.setPropertyValue("Height", new Integer(pageHeight));
xPageProperties.setPropertyValue("Width", new Integer(pageWidth));
xPageProperties.setPropertyValue("TopMargin", new Integer(pageMargin));
xPageProperties.setPropertyValue("BottomMargin", new Integer(pageMargin));
xPageProperties.setPropertyValue("LeftMargin", new Integer(pageMargin));
xPageProperties.setPropertyValue("RightMargin", new Integer(pageMargin));
} catch( Exception e) {
System.err.println("Could not set document properties.");
e.printStackTrace(System.err);
return false;
}
...
================ cut ==================
It dies with message:
"setPropertyValue(Unknown Source)";
What's wrong?
Thanks.