Could not get in the "Destionation Calc Document " as Source DATA - FORMAT, while Running BASIC-Macro

I Could not get "Source Calc Document " - DATA - Format in the " Destination Calc Document " while running the Basic Macro.
Here,
sor_Testing-01.ods (178.6 KB)
mac_Destin_Test-02.ods (34.6 KB)
My Code and attached my Sample Files and Screen shots

Sub test01
Dim Doc1 As Object, Doc2 As Object, oURL1 As String, oURL2 As String
Dim Array1(), Array2(), oRange1 As Object, oRange2 As Object

oURL1 = ConvertToUrl("C:\Users\Accounts-PC\Documents\sor_Testing-01.ods")
oURL2 = ConvertToUrl("C:\Users\Accounts-PC\Documents\mac_Destin_Test-02.ods")

Doc1 = starDeskTop.loadComponentFromURL (oURL1, "_blank", 0,Array1() )
Doc2 = starDeskTop.loadComponentFromURL (oURL2, "_blank", 0,Array2() )  

oRange1 = Doc1.Sheets(1).getCellRangeByName("A1:C5")
oRange2 = Doc2.Sheets(0).getCellRangeByName("A3:C7")
oRange2.setDataArray(oRange1.getDataArray())

Doc2.Sheets(0).Columns(2).OptimalWidth = True

End Sub

1

2

3

4

5

6.Destination Calc Document

You can use another technique described in the section “15.5.5. Copy data between documents” book by A.Pitonyak OOME_4_0.odt.

oRange1 = Doc1.Sheets(1).getCellRangeByName("A1:C5")
Doc1.CurrentController.select(oRange1)
o = Doc1.CurrentController.getTransferable()
  
oRange2 = Doc2.Sheets(0).getCellRangeByName("A3")
Doc2.CurrentController.select(oRange2)
Doc2.CurrentController.insertTransferable(o)

.

1 Like

Hi sokol92,

Thanks…wow…Its Resolved. As per your replay Comment, I tried the Code…and Run … Its Working…
All the Format what i did in Source_Doc1, they were stay in the Destination_Doc2…
Here, the Screen Shot…

Source_Doc1:

Destination_Doc2:

One more thanks… Sokul92…