Hello,
ich habe immer noch folgendes Problem:
Die Überschrift und der Inhalt der Listbox werden ganz links ausgedruckt.
Aber leider wird der Inhalt des Grids ca. 1cm weiter rechts vom Rand ausgedruck.
Wie muß ich Xpos bzw. CurrentX definieren, damit der Inhalt auch bündig unter dem Inhalt der Listbox steht?
With Printer
'Querformat
.Orientation = vbPRORLandscape
'Graustufen
.ColorMode = vbPRCMMonochrome
.FontName = "Courier New"
.FontSize = 7
.ScaleMode = 6
.FontBold = True
' Format (Spaltenbreiten) + Tabellenkopf
' anhand Bildschirm-Spaltenbreite ermitteln
PageWidth = .ScaleWidth - (XPos * 2)
str_Zeile = "Überschrift"
Printer.Print str_Zeile
.FontBold = False
str_Zeile = ""
Printer.Print str_Zeile
With List1
For i = 0 To .ListCount - 1
Printer.Print .List(i)
Next i
End With
str_Zeile = ""
Printer.Print str_Zeile
With MSHFlexGrid1
' Gesamtbreite
For int_i = 0 To 20
GridWidth = GridWidth + .ColWidth(int_i)
Next int_i
' Prozentuale Verteilung auf die Spalten
' plus Tabellenkopf
For int_i = 0 To 20
' zunächst Spaltenausrichtung berücksichtigen
Select Case .ColAlignment(int_i)
Case 3, 4, 5
' zentriert
fmt = fmt + "^"
Case 6, 7, 8
' rechtsbündig
fmt = fmt + ">"
End Select
' jetzt Spaltenbreite
intProz = (.ColWidth(int_i) / GridWidth * 100 + 0.5)
ColWidth = (PageWidth / 100 * intProz + 0.5)
fmt = fmt + Format$(ColWidth, "0")
' Tabellenkopf
sHeader = sHeader + .TextMatrix(0, int_i)
If int_i < .Cols - 1 Then
fmt = fmt + "|"
sHeader = sHeader + "|"
End If
Next int_i
End With
' Tabellenkopf drucken
.Font.Bold = True
.Font.Size = 7
PrintRow XPos, fmt, sHeader
.Font.Bold = False
' Grid-Inhalt zeilenweise drucken
With MSHFlexGrid1
For U = 1 To .Rows - 1
sRow = ""
If zeile = U Then
sHeader = ""
For int_i = 0 To 20
' zunächst Spaltenausrichtung berücksichtigen
Select Case .ColAlignment(int_i)
Case 3, 4, 5
' zentriert
fmt = fmt + "^"
Case 6, 7, 8
' rechtsbündig
fmt = fmt + ">"
End Select
' jetzt Spaltenbreite
intProz = (.ColWidth(int_i) / GridWidth * 100 + 0.5)
ColWidth = (PageWidth / 100 * intProz + 0.5)
fmt = fmt + Format$(ColWidth, "0")
' Tabellenkopf
sHeader = sHeader + .TextMatrix(U, int_i)
If int_i < .Cols - 1 Then
fmt = fmt + "|"
sHeader = sHeader + "|"
End If
Next int_i
' Tabellenkopf drucken
With Printer
.FontBold = True
.FontSize = 7
PrintRow XPos, fmt, sHeader
End With
Else
For int_i = 0 To 20
sRow = sRow + .TextMatrix(U, int_i)
If int_i < .Cols - 1 Then
sRow = sRow + "|"
End If
Next int_i
With Printer
.FontBold = False
.FontSize = 7
PrintRow XPos, fmt, sRow
End With
End If
Next U
End With
' Druckauftrag beenden
.EndDoc
End With
Screen.MousePointer = 0
MsgBox "Grid wurde ausgedruckt!", 64, "Drucken..." Hat jemand einen Tipp für mich?
MfG Sanni
* Phantasie ist wichtiger als Wissen, denn Wissen ist begrenzt * |