 | OO-Snippets: Setting orientation to landscapeCommons| Keywords | landscape, style |
|---|
| Language | Java |
|---|
| Application | Calc |
|---|
| Authors | Tom Schindl (initial)
|
|---|
| Supported Versions | 1.1.4 1.1.x |
|---|
| Supported OS | All |
|---|
| Question |
How do I switch the orientation
|
|---|
| Answer | Switching the orientation involves 2 steps you first have to switch the orientation and afterwards you have to switch the size (or the other way round) |
|---|
PropertyValue[] loadProps = new PropertyValue[0];
XComponent xCalcComponent = xComponentLoader.loadComponentFromURL("private:factory/scalc", "_blank", 0, loadProps);
XSpreadsheetDocument xSpreadsheetDocument = (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, xCalcComponent);
XStyleFamiliesSupplier xSupplier = ( XStyleFamiliesSupplier ) UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xSpreadsheetDocument );
XNameAccess xNameAccess = xSupplier.getStyleFamilies();
XNameContainer xPageStyleCollection = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xNameAccess.getByName( "PageStyles" ));
XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xPageStyleCollection.getByName("Default") );
Size size = (Size)xPropertySet.getPropertyValue("Size");
int height = size.Height;
size.Height=size.Width;
size.Width=height;
xPropertySet.setPropertyValue("Size",size);
xPropertySet.setPropertyValue("IsLandscape",new Boolean(true) );
|
Changelog| Date | User | Modification |
|---|
| 2005-03-10 | tomsontom | Fixed name of style-collection used | | 2005-03-10 | tomsontom | Initial version |
|