di Nicolantonio » 05/03/10 00:28
REM ***** BASIC *****
sub Stampa
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
do
rem ---------------------------stampa foglio corrente---------------------
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Copies"
args1(0).Value = 1
args1(1).Name = "Collate"
args1(1).Value = true
dispatcher.executeDispatch(document, ".uno:Print", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "ToPoint"
args2(0).Value = "E57"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args4(0) as new com.sun.star.beans.PropertyValue
args4(0).Name = "ToPoint"
args4(0).Value = "$E$1"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args4())
rem ----------------------------------------------------------------------
dim args5(5) as new com.sun.star.beans.PropertyValue
args5(0).Name = "Flags"
args5(0).Value = "V"
args5(1).Name = "FormulaCommand"
args5(1).Value = 0
args5(2).Name = "SkipEmptyCells"
args5(2).Value = false
args5(3).Name = "Transpose"
args5(3).Value = false
args5(4).Name = "AsLink"
args5(4).Value = false
args5(5).Name = "MoveMode"
args5(5).Value = 4
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args5())
rem ----------------------------------------------------------------------
dim args6(0) as new com.sun.star.beans.PropertyValue
args6(0).Name = "ToPoint"
args6(0).Value = "H57"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args6())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args8(0) as new com.sun.star.beans.PropertyValue
args8(0).Name = "ToPoint"
args8(0).Value = "$H$1"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args8())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:Undo", "", 0, Array())
rem ----------------------------------------------------------------------
dim args11(5) as new com.sun.star.beans.PropertyValue
args11(0).Name = "Flags"
args11(0).Value = "V"
args11(1).Name = "FormulaCommand"
args11(1).Value = 0
args11(2).Name = "SkipEmptyCells"
args11(2).Value = false
args11(3).Name = "Transpose"
args11(3).Value = false
args11(4).Name = "AsLink"
args11(4).Value = false
args11(5).Name = "MoveMode"
args11(5).Value = 4
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args11())
j1 = Range("J51").Value ' questa è l'istruzione dove si ferma "funzione non definita"
loop until j1 > 1
end sub