Hi Martin,
Alle 11:39, mercoledì 30 novembre 2005, Martin Thoma ha scritto:
> Hello!
>
> In the GUI, you can select some cells in calc, press DEL and then choose
> "delete all" to remove everything from the selected cells.
>
> How is this done using the API? I want to give a column and delete the
> content of this completely without removing the whole column.
>
> Okay, I could get the used area, iterate over all the cells in the
> CellRange, query a XTextRange and use setString to empty the cell, but
> isn't there a more efficient way?
Yes, here is an example of the call.
BTW this is a very common question, so maybe it worth a codesnippet :-)
REM ***** BASIC *****
Option Explicit
Sub ExampleClearContents
Dim oRange As Object
Dim iCellAttr As Integer
iCellAttr = _
com.sun.star.sheet.CellFlags.VALUE + _
com.sun.star.sheet.CellFlags.DATETIME + _
com.sun.star.sheet.CellFlags.STRING + _
com.sun.star.sheet.CellFlags.ANNOTATION + _
com.sun.star.sheet.CellFlags.FORMULA + _
com.sun.star.sheet.CellFlags.HARDATTR + _
com.sun.star.sheet.CellFlags.STYLES + _
com.sun.star.sheet.CellFlags.OBJECTS + _
com.sun.star.sheet.CellFlags.EDITATTR
oRange = ThisComponent.Sheets(0).getCellRangeByName("A1:B4")
oRange.ClearContents(iCellAttr)
End Sub
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]