Ciao, ho un problema con una macro che il buon Cesare mi ha preparato qualche
tempo fà per copiare i dati dal file "fattura" al file "dati, vorrei
modificarla per aggiungere altre 3 colonne al range copiato, al posto
dell'intervallo "A13:I44" vorrei che mi copiasse "A13:N44. Grazie in anticipo a
chi mi può aiutare. Nicola
Sub Nico
Dim aFileProp(0) As New com.sun.star.beans.PropertyValue
oDoc = ThisComponent
oSheet = oDoc.Sheets.getByName("Foglio1")
oCopyRange = oSheet.getCellRangeByName("A13:I44")
'oDoc.CurrentController.Select(oRange)
'oTransferable = oDoc.CurrentController.getTransferable()
oDoc =
StarDesktop.LoadComponentFromURL(ConvertToURL("/home/nicola/fatture/dati.ods"),
"_default", 0, aFileProp())
oSheet = oDoc.Sheets.getByName("Foglio1")
oCellCursor = oSheet.createCursor()
oCellCursor.gotoEndOfUsedArea(False)
nEndRow = oCellCursor.getRangeAddress().endRow + 1
oPasteRange = oSheet.getCellRangeByPosition(0, nEndRow, 8, nEndRow + (44 -
13)) '0=A 8=I
'oDoc.CurrentController.Select(oRange)
'oDoc.CurrentController.insertTransferable(oTransferable)
oPasteRange.DataArray = oCopyRange.DataArray
For i = nEndRow + (44 - 13) To nEndRow Step -1
If oSheet.getCellByPosition(0, i).Type =
com.sun.star.table.CellContentType.EMPTY Then
oSheet.getRows.removeByIndex (i, 1)
End If
Next i
oDoc.store()
oDoc.close(false)
End Sub