Date: prev next · Thread: first prev next last
2018 Archives by date, by thread · List index


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+unsubscribe@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

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.