Below is a summary of the post I made to oooforum.org:
(http://www.oooforum.org/forum/viewtopic.phtml?t=65999)
I know how to select the input tray:
PrinterPaperTray is being used as the input tray.
These are my defined trays:
Code: Select all
INPUT TRAYS:
Bypass Tray
Tray 1
Tray 2
OUTPUT TRAYS
Inner Tray 1 (Lower)
Code: Select all
XTextDocument aTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xcomp);
XText xText = aTextDocument.getText();
XTextCursor xTextCursor = xText.createTextCursor();
XPropertySet xTextCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
String pageStyleName = xTextCursorProps.getPropertyValue("PageStyleName").toString();
XStyleFamiliesSupplier xSupplier = (XStyleFamiliesSupplier) UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, aTextDocument);
XNameAccess xFamilies = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xSupplier.getStyleFamilies());
XNameContainer xFamily = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xFamilies.getByName("PageStyles"));
XStyle xStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, xFamily.getByName(pageStyleName));
XPropertySet xStyleProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xStyle);
xStyleProps.setPropertyValue("PrinterPaperTray","Tray 1");