21.08.2013 Views

OpenOffice.org BASIC Guide - OpenOffice.org wiki

OpenOffice.org BASIC Guide - OpenOffice.org wiki

OpenOffice.org BASIC Guide - OpenOffice.org wiki

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

StartColumn (long)<br />

first column in the cell range (numbering begins with 0).<br />

StartRow (long)<br />

first row in the cell range (numbering begins with 0).<br />

EndColumn (long)<br />

final column in the cell range (numbering begins with 0).<br />

EndRow (long)<br />

final row in the cell range (numbering begins with 0).<br />

The Structure of Spreadsheets<br />

The completed CellRangeAddress structure must be passed as the first parameter to the insertCells<br />

method. The second parameter of insertCells contains a value of the com.sun.star.sheet.CellInsertMode<br />

enumeration and defines what is to be done with the values that are located in front of the insert position. The<br />

CellInsertMode enumeration recognizes the following values:<br />

NONE<br />

DOWN<br />

RIGHT<br />

ROWS<br />

COLUMNS<br />

the current values remain in their present position.<br />

the cells at and under the insert position are moved downwards.<br />

the cells at and to the right of the insert position are moved to the right.<br />

the rows after the insert position are moved downwards.<br />

the columns after the insert position are moved to the right.<br />

The removeRange method is the counterpart to the insertCells method. This method deletes the range that is<br />

defined in the CellRangeAddress structure from the sheet.<br />

Dim Doc As Object<br />

Dim Sheet As Object<br />

Dim CellRangeAddress As New com.sun.star.table.CellRangeAddress<br />

Doc = ThisComponent<br />

Sheet = Doc.Sheets(0)<br />

CellRangeAddress.Sheet = 0<br />

CellRangeAddress.StartColumn = 1<br />

CellRangeAddress.StartRow = 1<br />

CellRangeAddress.EndColumn = 2<br />

CellRangeAddress.EndRow = 2<br />

Sheet.removeRange(CellRangeAddress, com.sun.star.sheet.CellDeleteMode.UP)<br />

This example removes the B2:C3 cell range from the sheet and then shifts the underlying cells up by two rows.<br />

The type of removal is defined by one of the following values from the com.sun.star.sheet.CellDeleteMode<br />

enumeration:<br />

NONE<br />

UP<br />

LEFT<br />

ROWS<br />

the current values remain in their current position.<br />

the cells at and below the insert position are moved upwards.<br />

the cells at and to the right of the insert position are moved to the left.<br />

the rows after the insert position are moved upwards.<br />

Chapter 7 · Spreadsheet Documents 97

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!