von komma4 » Do, 15.09.2011 12:17
quarkus hat geschrieben:Geht das?
Eine solche Funktion ist nicht eingebaut, aber...
Wenn es um die Ausgabe der Summe in der Kopfzeile einer WRITER-Tabelle geht, dann hab' ich ein Makro dafür
Code: Alles auswählen
REM*****BASIC*****
Sub setTableSumRow
Dim oVCurs
Dim oCurCell
Dim oTable
Dim lCount as Long ' Row counter
oVCurs = ThisComponent.getCurrentController().getViewCursor()
REM Is the cursor in a table?
If IsEmpty(oVCurs.TextTable) Then
Print "The cursor is NOT in a table"
Exit Sub
End If
oTable = oVCurs.TextTable
lCount= oTable.getRows.Count
oCell = oTable.getCellByPosition(1,0)
oCell.setFormula ("=Sum <B2:B" & lCount & ">" )
End Sub
In der letzten Zeile ist natürlich noch die Formel zu ändern.
Ausserdem der Spaltenindex in
.getCellByPosition: 1=B, 4=E
Kommst Du damit zurecht?
[quote="quarkus"]Geht das?[/quote]
Eine solche Funktion ist nicht eingebaut, aber...
Wenn es um die Ausgabe der Summe in der Kopfzeile einer WRITER-Tabelle geht, dann hab' ich ein Makro dafür
[code]REM*****BASIC*****
Sub setTableSumRow
Dim oVCurs
Dim oCurCell
Dim oTable
Dim lCount as Long ' Row counter
oVCurs = ThisComponent.getCurrentController().getViewCursor()
REM Is the cursor in a table?
If IsEmpty(oVCurs.TextTable) Then
Print "The cursor is NOT in a table"
Exit Sub
End If
oTable = oVCurs.TextTable
lCount= oTable.getRows.Count
oCell = oTable.getCellByPosition(1,0)
oCell.setFormula ("=Sum <B2:B" & lCount & ">" )
End Sub[/code]
In der letzten Zeile ist natürlich noch die Formel zu ändern.
Ausserdem der Spaltenindex in [color=#008000].getCellByPosition[/color]: 1=B, 4=E
Kommst Du damit zurecht?