Label Ranges

From Apache OpenOffice Wiki
Jump to: navigation, search

A label range consists of a label area containing the labels, and a data area containing the data that the labels address. There are label ranges for columns and rows of data, which are kept in two separate collections in the document.

Label Ranges

The service contains the document's column label ranges or row label ranges, depending if the ColumnLabelRanges or RowLabelRanges property was used to get it. The interface's addNew() method is used to add a new label range, specifying the label area and data area. The removeByIndex() method removes a label range.

The service represents a single label range and contains the interface to modify the label area and data area.

The following example inserts a column label range with the label area G48:H48 and the data area G49:H50, that is, the content of G48 is used as a label for G49:G50 and the content of H48 is used as a label for H49:H50, as shown in the two formulas the example inserts. xRange = xSheet.getCellRangeByPosition(6, 47, 7, 49); xData = (
     UnoRuntime.queryInterface(, xRange);
 Object[][] aValues =
     {"Apples", "Oranges"},
     {new Double(5), new Double(7)},
     {new Double(6), new Double(8)}
 // insert a column label range
 Object aLabelsObj = xDocProp.getPropertyValue("ColumnLabelRanges"); xLabelRanges = (
     UnoRuntime.queryInterface(, aLabelsObj); aLabelArea = new;
 aLabelArea.Sheet = 0;
 aLabelArea.StartColumn = 6;
 aLabelArea.StartRow = 47;
 aLabelArea.EndColumn = 7;
 aLabelArea.EndRow = 47; aDataArea = new;
 aDataArea.Sheet = 0;
 aDataArea.StartColumn = 6;
 aDataArea.StartRow = 48;
 aDataArea.EndColumn = 7;
 aDataArea.EndRow = 49;
 xLabelRanges.addNew(aLabelArea, aDataArea);
 // use the label range in formulas
 xSheet.getCellByPosition(8, 48).setFormula("=Apples+Oranges");
 xSheet.getCellByPosition(8, 49).setFormula("=Apples+Oranges");
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages