 | OO-Snippets: Changing background of documentCommons| Keywords | page properties, page background-color, IllegalArgumentException |
|---|
| Language | Java |
|---|
| Application | Writer |
|---|
| Authors | Tom Schindl (initial)
|
|---|
| Supported Versions | 1.1.3 |
|---|
| Supported OS | |
|---|
| Question |
Changing background of swriter-document using Java-UNO produces IllegalArgumentException
|
|---|
| Answer |
The long value that the idl of the service states is mapped to an integer in Java.
So you are only allowed to set the property to integer values. See the Developer's Guide that
comes with the SDK on the mapping of idl types to Java, it's chapter 2.5.3. (Steffen.Grund@sun.com)
|
|---|
private void createDocument() throws Exception {
XComponentLoader aLoader = (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class,m_xMSF_.createInstance( "com.sun.star.frame.Desktop" ));
XComponent xDocument = UNO.queryComponent(aLoader.loadComponentFromURL( "private:factory/swriter", "_blank", 0, new PropertyValue[ 0 ] ) );
XTextDocument oDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xDocument);
XStyleFamiliesSupplier xSupplier = ( XStyleFamiliesSupplier ) UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, oDoc );
XNameAccess xNameAccess = xSupplier.getStyleFamilies();
XNameContainer xPageStyleCollection = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xNameAccess.getByName( "PageStyles" ));
XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xPageStyleCollection.getByName("Standard") );
xPropertySet.setPropertyValue("BackColor",new Integer( (int)255 ) );
}
|
Changelog| Date | User | Modification |
|---|
| 2004-06-08 | tomsontom | Modified to match codesnippet.dtd v2.0 | | 2004-02-01 | tomsontom | Intial version |
|