LibreOffice Basic - Objecten

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

Dit artikel is vooral bedoeld als referentie. Daarom bronnen gelijk in de afzonderlijke hoofdstukken opnemen.

copyByName()

copyByName is een method van sheets.

Syntaxis

void copyByName
(
   [in] string aName,
   [in] string aCopy,
   [in] short  nDestination
)

* aName:        Name of the sheet to be copied
* aCopy:        Name of the copied sheet
* nDestination: Numerical index of the new sheet

Voorbeeld

Sub CopySheet
    Dim oCurrentController As Object
    Dim oActiveSheet As Object
    Dim oSheets As Object
    oCurrentController = ThisComponent.getCurrentController()
    oActiveSheet = oCurrentController.getActiveSheet()
    oSheets = ThisComponent.getSheets()
    If oSheets.hasByName( oActiveSheet.Name & "Copy" ) Then
        MsgBox "Sheet name " & oActiveSheet.Name & "Copy, already exists"
    Else
        oSheets.copyByName(oActiveSheet.Name, oActiveSheet.Name & "Copy", oActiveSheet.RangeAddress.Sheet + 1)
    End If
End Sub

Bronnen

getCellRangeByPosition()

Kopiëer cellen aan de hand van hun coördinaten - Method van sheets

Syntaxis

data_array = sheet.getCellRangeByPosition
(
   x_start,
   y_start,
   x_end,
   y_end
)

Voorbeeld

function copy_paste_test()
	'
	''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
	' Copy & paste een paar cellen binnen de eerste sheet
	''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
	'
	cell_org=ThisComponent.sheets(0).getCellRangeByPosition(0,0,0,2)
	cell_dest=ThisComponent.sheets(0).getCellByPosition(3,3)

	ThisComponent.sheets(0).copyRange _
	( _
		cell_dest.CellAddress, _
		cell_org.RangeAddress _
	)	
	
end function

getDataArray()

Get an array from the contents of the cell range.

Syntaxis

sequence< sequence< any > > getDataArray()

Bronnen

gotoEndOfUsedArea()

Ga met de cursor naar de laatste gebruikte cel in betreffende sheet.

Syntaxis

gotEndOfUserArea
(
   boolean bExpand
)