Hi Andrew,

Andrew Douglas Pitonyak schrieb:
On 06/26/2014 03:25 AM, IMMO WETZEL wrote:
I'm working on a huge document with a lot of tables and images and so on.
Now I have to modify a table and to delete empty/unused rows. Every
Row has an unique text string in the first cell.

How can I delete these rows without knowing the exact position of this
row.

Are the any way to fill the removebyindex function with data ?

I guess there must be something like

-          Search the text

-          Detect the row number

-          Remove the row
But I couldn't find it


Immo



Although I don't have an answer off hand....

The view cursor has a TextTable property and a Cell property that tell
you the current text table and the current cell. The cell object has a
property named CellName which may be of assistance.


Yes, that way I have it done for to insert a row before the current cursor position.

CellName is e.g. "B3" or "AA24". In the loop I extract the number from this string.

Sub InsertRowBefore
dim oCurrentController as variant
oCurrentController = ThisComponent.getCurrentController()
dim oViewCursor as variant
oViewCursor =oCurrentController.getViewCursor()
dim oActualWriterTable as variant
oActualWriterTable = oViewCursor.TextTable
if NOT(isEmpty(oActualWriterTable)) then
        dim oCell as variant
        oCell = oViewCursor.Cell
        dim oCellName as string
        oCellName = oCell.CellName
        dim nCount as long
        nCount =len(oCellName)
        dim sTeil as string
        do
                nCount = nCount-1
                sTeil = right(oCellName,nCount)
        loop until isNumeric(sTeil)
        dim nRow as long: nRow = CLng(sTeil)
        oActualWriterTable.Rows.insertByIndex(nRow-1,1)
endif
End Sub

Kind regards
Regina


---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org

Reply via email to