Difference between revisions of "Documentation/DevGuide/Spreadsheets/Column and Row Access"
From Apache OpenOffice Wiki
< Documentation | DevGuide
OOoWikiBot (Talk | contribs) m (FINAL VERSION FOR L10N) |
|||
Line 16: | Line 16: | ||
<!--[SOURCE:Spreadsheet/SpreadsheetSample.java]--> | <!--[SOURCE:Spreadsheet/SpreadsheetSample.java]--> | ||
− | + | <syntaxhighlight lang="java"> | |
// --- Column properties. --- | // --- Column properties. --- | ||
com.sun.star.table.XColumnRowRange xColRowRange = (com.sun.star.table.XColumnRowRange) | com.sun.star.table.XColumnRowRange xColRowRange = (com.sun.star.table.XColumnRowRange) | ||
Line 30: | Line 30: | ||
UnoRuntime.queryInterface(com.sun.star.container.XNamed.class, aColumnObj); | UnoRuntime.queryInterface(com.sun.star.container.XNamed.class, aColumnObj); | ||
System.out.println("The name of the wide column is " + xNamed.getName() + "."); | System.out.println("The name of the wide column is " + xNamed.getName() + "."); | ||
− | + | </syntaxhighlight> | |
{{PDL1}} | {{PDL1}} | ||
[[Category:Documentation/Developer's Guide/Spreadsheet Documents]] | [[Category:Documentation/Developer's Guide/Spreadsheet Documents]] |
Latest revision as of 15:22, 3 January 2021
The cell range interface com.sun.star.table.XColumnRowRange accesses the column and row ranges in the current cell range. A column or row range contains all the cells in the selected column or row. This type of range has additional properties, such as, visibility, and width or height. For more information, see Columns and Rows.
- The method
getColumns()
returns the interface com.sun.star.table.XTableColumns of the collection of columns. - The method
getRows()
returns the interface com.sun.star.table.XTableRows of the collection of rows.
// --- Column properties. --- com.sun.star.table.XColumnRowRange xColRowRange = (com.sun.star.table.XColumnRowRange) UnoRuntime.queryInterface(com.sun.star.table.XColumnRowRange.class, xCellRange); com.sun.star.table.XTableColumns xColumns = xColRowRange.getColumns(); Object aColumnObj = xColumns.getByIndex(0); xPropSet = (com.sun.star.beans.XPropertySet) UnoRuntime.queryInterface( com.sun.star.beans.XPropertySet.class, aColumnObj); xPropSet.setPropertyValue( "Width", new Integer( 6000 ) ); com.sun.star.container.XNamed xNamed = (com.sun.star.container.XNamed) UnoRuntime.queryInterface(com.sun.star.container.XNamed.class, aColumnObj); System.out.println("The name of the wide column is " + xNamed.getName() + ".");
Content on this page is licensed under the Public Documentation License (PDL). |