Sub UnirHojas

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Sub UnirHojas()

dim document as object


dim dispatcher as object
dim args1(5) as new com.sun.star.beans.PropertyValue
dim args3(0) as new com.sun.star.beans.PropertyValue
'--------------------------------------------------------------------------
--------------------------------------------------
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
args3(0).Name = "Sel"
args3(0).Value = true
'--------------------------------------------------------------------------
--------------------------------------------------
ThisComponent.Sheets.InsertNewByName("UnionDeDatos",0)
ThisComponent.CurrentController.Select(ThisComponent.Sheets(0).GetCellRange
ByName("A1"))
'--------------------------------------------------------------------------
---------------------------------------------------
for a = 1 to ThisComponent.Sheets.GetCount()-1
ThisComponent.CurrentController.Select(ThisComponent.Sheets(a).GetCellRange
ByName("A1"))
dispatcher.executeDispatch(document, ".uno:GoToEndOfData", "", 0, args3())
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
args1(0).Name = "Nr"
args1(0).Value = 1
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args1())
args1(0).Name = "Flags"
args1(0).Value = "SV"
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:GoToEndOfData", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:GoLeftToStartOfData", "", 0,
args1())
next
'--------------------------------------------------------------------------
--------------------------------------------------------------
ThisComponent.CurrentController.Select(ThisComponent.Sheets(0).GetCellRange
ByName("A1"))
dispatcher.executeDispatch(document, ".uno:GoToEndOfData", "", 0, args3())
args1(0).Name = "aExtraWidth"
args1(0).Value = 100
dispatcher.executeDispatch(document, ".uno:SetOptimalColumnWidth", "", 0,
args1())
End Sub

You might also like