von Ford-Prefekt » Di, 03.03.2009 22:45
das makro für eine Tabelle
Code: Alles auswählen
Sub optidruck
vorgabe = 0
status = 8
DIM zeile(15)
zeile = ARRAY (17,35,53,71,89,15,33,51,69,87,13,31,49,67,85)
For x = 0 to 14
If status >= 0 Then
If ThisComponent.Sheets.GetByName("Woche1").getCellByPosition(vorgabe, zeile(x)-1).String = "" Then
ThisComponent.Sheets.GetByName("Woche1").Rows(zeile(x)).isVisible = False
ThisComponent.Sheets.GetByName("Woche1").Rows(zeile(x)-1).isVisible = False
status = status - 1
End if
End if
Next x
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
oDoc=thisComponent
Sheet = oDoc.Sheets(8)
Cell = Sheet.getCellByPosition(11, 7)
printerbez = Cell.String
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Printer"
args1(0).Value = printerbez
dispatcher.executeDispatch(document, ".uno:Printer", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(2) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Copies"
args2(0).Value = 1
args2(1).Name = "Selection"
args2(1).Value = true
args2(2).Name = "Collate"
args2(2).Value = false
dispatcher.executeDispatch(document, ".uno:Print", "", 0, args2())
dispatcher.executeDispatch(document, ".uno:SelectAll", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:ShowRow", "", 0, Array())
end sub
Das funktioniert, einzeln für jede Tabelle.
Eine nicht optimierte Tabelle hat ca. 1,5 DIN A4 Länge.
in der Form
sub xxx
call optidruck
call optidruck2
...
sub end
wird nur das letzte optimiert (habe ich unter oo2 nicht versucht)
was jetzt nicht mehr funktioniert verwendet die Zeilenausblendung nach obigen Vorbild für alle Tabellen
- das funktioniert, das ist der Endstand am Schirm -
dann soll gedruckt werden
Code: Alles auswählen
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
oDoc=thisComponent
Sheet = oDoc.Sheets(8)
Cell = Sheet.getCellByPosition(11, 7)
printerbez = Cell.String
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Printer"
args1(0).Value = printerbez
dispatcher.executeDispatch(document, ".uno:Printer", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Copies"
args2(0).Value = 1
args2(1).Name = "Collate"
args2(1).Value = false
dispatcher.executeDispatch(document, ".uno:Print", "", 0, args2())
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "Nr"
args3(0).Value = 1
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args3())
dispatcher.executeDispatch(document, ".uno:SelectAll", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:ShowRow", "", 0, Array())
rem ----------------------------------------------------------------------
dim args4(0) as new com.sun.star.beans.PropertyValue
..... für alle Tabellen und 2 weitere Druckbereiche
keine Fehlermeldung, kein Druck ... keine Ahnung wo ich ansetzen soll.
Ich bin wahrlich nicht in den Makros heimisch, das Makro ist das Ergebniss von verschiedenen Beschreibungen, Dokumentationen und MakroAufzeichnungen.
Ford
das makro für eine Tabelle
[code]Sub optidruck
vorgabe = 0
status = 8
DIM zeile(15)
zeile = ARRAY (17,35,53,71,89,15,33,51,69,87,13,31,49,67,85)
For x = 0 to 14
If status >= 0 Then
If ThisComponent.Sheets.GetByName("Woche1").getCellByPosition(vorgabe, zeile(x)-1).String = "" Then
ThisComponent.Sheets.GetByName("Woche1").Rows(zeile(x)).isVisible = False
ThisComponent.Sheets.GetByName("Woche1").Rows(zeile(x)-1).isVisible = False
status = status - 1
End if
End if
Next x
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
oDoc=thisComponent
Sheet = oDoc.Sheets(8)
Cell = Sheet.getCellByPosition(11, 7)
printerbez = Cell.String
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Printer"
args1(0).Value = printerbez
dispatcher.executeDispatch(document, ".uno:Printer", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(2) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Copies"
args2(0).Value = 1
args2(1).Name = "Selection"
args2(1).Value = true
args2(2).Name = "Collate"
args2(2).Value = false
dispatcher.executeDispatch(document, ".uno:Print", "", 0, args2())
dispatcher.executeDispatch(document, ".uno:SelectAll", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:ShowRow", "", 0, Array())
end sub[/code]
Das funktioniert, einzeln für jede Tabelle.
Eine nicht optimierte Tabelle hat ca. 1,5 DIN A4 Länge.
in der Form
sub xxx
call optidruck
call optidruck2
...
sub end
wird nur das letzte optimiert (habe ich unter oo2 nicht versucht)
was jetzt nicht mehr funktioniert verwendet die Zeilenausblendung nach obigen Vorbild für alle Tabellen
- das funktioniert, das ist der Endstand am Schirm -
dann soll gedruckt werden
[code]dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
oDoc=thisComponent
Sheet = oDoc.Sheets(8)
Cell = Sheet.getCellByPosition(11, 7)
printerbez = Cell.String
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Printer"
args1(0).Value = printerbez
dispatcher.executeDispatch(document, ".uno:Printer", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Copies"
args2(0).Value = 1
args2(1).Name = "Collate"
args2(1).Value = false
dispatcher.executeDispatch(document, ".uno:Print", "", 0, args2())
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "Nr"
args3(0).Value = 1
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args3())
dispatcher.executeDispatch(document, ".uno:SelectAll", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:ShowRow", "", 0, Array())
rem ----------------------------------------------------------------------
dim args4(0) as new com.sun.star.beans.PropertyValue
..... für alle Tabellen und 2 weitere Druckbereiche[/code]
keine Fehlermeldung, kein Druck ... keine Ahnung wo ich ansetzen soll.
Ich bin wahrlich nicht in den Makros heimisch, das Makro ist das Ergebniss von verschiedenen Beschreibungen, Dokumentationen und MakroAufzeichnungen.
Ford