Hallo Andreas & Wolfgang,

jetzt aber:


  Sub InsertRow

'    A c h t u n g
' iColMax muss an die Anzahl Spalten der aktuellen Tabelle angepasst werden:
'    iColMax = 'Anzahl Spalten' - 1
' Der Spalten-Index beginnt bei 0, weswegen man von der 'Anzahl Spalten' 1
'    abziehen muss.

     Dim oDoc    as Object ' object Document
     Dim oSheet  as Object ' object Sheet
     Dim oRow    as Object ' object Row
     Dim iCol    as Long   ' index  Column     (i=0 => 1st Column)
     Dim iColMax as Long   ' index  Column Maximum
     Dim iRowIns as Long   ' index  Row Insert (i=0 => 1st Row   )

     oDoc   = ThisComponent
     oSheet = oDoc.Sheets(0)
     oRow   = oSheet.getRows

     iRowIns = 1
     iColMax = 4

'    Zeile einfügen:
     oRow.insertByIndex(iRowIns,1)

     For iCol=0 To iColMax Step 1

'       [0] Zell-Typ übernehmen:
oSheet.getCellByPosition(iCol,iRowIns).NumberFormat = oSheet.getCellByPosition(iCol,iRowIns+1).NumberFormat
'       [1] Zell-Inhalt Schriftattribut "Name" übernehmen:
oSheet.getCellByPosition(iCol,iRowIns).CharFontName = oSheet.getCellByPosition(iCol,iRowIns+1).CharFontName
'       [2] Zell-Inhalt Schriftattribut "Größe" übernehmen:
oSheet.getCellByPosition(iCol,iRowIns).CharHeight = oSheet.getCellByPosition(iCol,iRowIns+1).CharHeight
'       [3] Zell-Inhalt Schriftattribut "Farbe" übernehmen:
oSheet.getCellByPosition(iCol,iRowIns).CharColor = oSheet.getCellByPosition(iCol,iRowIns+1).CharColor
'       [4] Zell-Inhalt Schriftattribut "fett" übernehmen:
oSheet.getCellByPosition(iCol,iRowIns).CharWeight = oSheet.getCellByPosition(iCol,iRowIns+1).CharWeight
'       [5] Zell-Inhalt Schriftattribut "kursiv" übernehmen:
oSheet.getCellByPosition(iCol,iRowIns).CharPosture = oSheet.getCellByPosition(iCol,iRowIns+1).CharPosture
'       [6] Zell-Hintergrund "Farbe" übernehmen:
oSheet.getCellByPosition(iCol,iRowIns).CellBackColor = oSheet.getCellByPosition(iCol,iRowIns+1).CellBackColor
'       [7] Zell-Inhalt "vertikale Ausrichtung" übernehmen:
oSheet.getCellByPosition(iCol,iRowIns).VertJustify = oSheet.getCellByPosition(iCol,iRowIns+1).VertJustify
'       [8] Zell-Inhalt "horizontale Ausrichtung" übernehmen:
oSheet.getCellByPosition(iCol,iRowIns).HoriJustify = oSheet.getCellByPosition(iCol,iRowIns+1).HoriJustify

     Next iCol

  End Sub


[1] Ergänzt um Formatierungsangaben [1]-[8].
[2] Falls Du zu Deiner Tabelle noch weitere Spalten hinzufügst, unbedingt "iColMax" anpassen !!!


Gruß
Hans-Werner :-))

--
Liste abmelden mit E-Mail an: users+unsubscr...@de.libreoffice.org
Probleme? 
https://de.libreoffice.org/hilfe-kontakt/mailing-listen/abmeldung-liste/
Tipps zu Listenmails: https://wiki.documentfoundation.org/Netiquette/de
Listenarchiv: https://listarchives.libreoffice.org/de/users/
Datenschutzerklärung: https://www.documentfoundation.org/privacy

Antwort per Email an