Copy values and formats with a BASIC-Script

I want to copy the values, the formats and all conditional formats from an LibreOffice-Calc worksheet-range (A1:H100) to another (new/empty) worksheet of the same workbook.

This is, what I do actually:

sub blatt_einfuegen

  oActiveSheet = ThisComponent.CurrentController.ActiveSheet
  oTabellen = ThisComponent.Sheets
  sNewSheetName=oActiveSheet.getCellRangeByName("C1").String
  
  
  ' Prüfen, ob eine Tabelle mit dem Namen des Strings aus Zelle C1 existiert.
  If NOT oTabellen.hasbyName(sNewSheetName) Then
    ' Tabelle mit dem Namene sNewSheetName existiert nicht, also wird sie eingefügt.
    oTabellen.insertNewByName (sNewSheetName, 3)
  End If
  
  DIM oStart as Object, oZiel as Object

  oStart = ThisComponent.sheets.getByName("Aktuell")     '<--- Blatt wo die Daten stehen
  oZiel = ThisComponent.sheets.getByName(sNewSheetName)  '<--- Blatt wohin die Daten kopiert werden sollen

  ' Zellinhalte übertragen
  Dim aDataArray()  
  aDataArray = oStart.getCellRangeByName("A1:H100").getDataArray
  oZiel.getCellRangeByName("A1:H100").setDataArray(aDataArray)
 
  ' Spaltenbreiten übertragen
  For j = 0 To 6
    oZiel.Columns.getByIndex(j).Width = oStart.Columns.getByIndex(j).Width
  Next j

  Call CopyFormatBetweenSheets(sNewSheetName)
  
End Sub
Sub CopyFormatBetweenSheets(sName$)
    Dim oSourceSheet As Object
    Dim oTargetSheet As Object
    Dim oSourceRange As Object
    Dim oTargetRange As Object
    Dim i As Integer
    Dim j As Integer
    
    ' Get the source sheet (where the source range is located)
    oSourceSheet = ThisComponent.Sheets.getByName("Aktuell")
    
    ' Get the target sheet (where the target range is located)
    oTargetSheet = ThisComponent.Sheets.getByName(sName)    
    
    ' Define the source range (range with the formatting to be copied)
    oSourceRange = oSourceSheet.getCellRangeByName("A1:H100")
    
    ' Define the target range (range where the formatting will be applied)
    oTargetRange = oTargetSheet.getCellRangeByName("A1:H100")

    ' Copy the formatting from the source range to the target range
    For i = 0 To oSourceRange.Rows.getCount() - 1
       For j = 0 To oSourceRange.Columns.getCount() - 1
            oTargetRange.getCellByPosition(j, i).CharFontName = oSourceRange.getCellByPosition(j, i).CharFontName
            oTargetRange.getCellByPosition(j, i).CharHeight = oSourceRange.getCellByPosition(j, i).CharHeight
            oTargetRange.getCellByPosition(j, i).CharWeight = oSourceRange.getCellByPosition(j, i).CharWeight
            oTargetRange.getCellByPosition(j, i).NumberFormat = oSourceRange.getCellByPosition(j, i).NumberFormat
            oTargetRange.getCellByPosition(j, i).CharUnderline = oSourceRange.getCellByPosition(j, i).CharUnderline
            oTargetRange.getCellByPosition(j, i).HoriJustify = oSourceRange.getCellByPosition(j, i).HoriJustify
            oTargetRange.getCellByPosition(j, i).VertJustify = oSourceRange.getCellByPosition(j, i).VertJustify
            oTargetRange.getCellByPosition(j, i).ConditionalFormat = oSourceRange.getCellByPosition(j, i).ConditionalFormat

            ' Add more properties as needed (e.g., CharColor, CellBackColor, etc.)
       Next j
    Next i
End Sub

It copies the values, the formats, but only the first conditional format, what is defined in the cells from oSourceRange.

Is it possible to copy all of the conditional formats of the cells or is there a better way for copying the oSourceRange values, formats and conditional formats to the oTargetRange?

The values are copyied by an array-method (.setDataArray) – Is there a method for doing this with the fomats?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật