Hallo, hat ein bischen gedauert aber ich habe es hinbekommen, ich poste hier mal meinen Code damit ihr seht wie ich das gelöst habe. Es druckt jetzt eine oder mehrere Seiten, je nach Bedarf.So ist die Grundfunktion fertig. Das ist jetzt die Rohfassung, werde es noch ein bischen ausbauen und perfektionieren.
Vielen Dank für eure tolle Unterstützung und Anregungen
Wenn Bedarf entsteht poste ich später auch gerne die gesamte Druckgeschichte.
firstrow=0 ist als Integer deklariert
16 ist Zeilenanzahl die aufs Blatt passen ( Querformat )
For i As Integer = firstRow To dt.Rows.Count - 1
If i - firstRow < 16 Then
e.Graphics.DrawString(dt.Rows(i)("vorname"), New Font("Times" & _
"New Roman", 10, FontStyle.Regular), Brushes.Black, y_achse, _
x_achse, text_links)
e.Graphics.DrawString(dt.Rows(i)("nachname"), New Font("Times" & _
"New Roman", 10, FontStyle.Regular), Brushes.Black, y_achse + _
100, x_achse, text_links)
e.Graphics.DrawString(dt.Rows(i)("strasse"), New Font("Times" & _
"New Roman", 10, FontStyle.Regular), Brushes.Black, y_achse + _
230, x_achse, text_links)
e.Graphics.DrawString(dt.Rows(i)("plz"), New Font("Times New" & _
"Roman", 10, FontStyle.Regular), Brushes.Black, y_achse + 410, _
x_achse, text_links)
e.Graphics.DrawString(dt.Rows(i)("wohnort"), New Font("Times" & _
"New Roman", 10, FontStyle.Regular), Brushes.Black, y_achse + _
500, x_achse, text_links)
e.Graphics.DrawString(dt.Rows(i)("telefon"), New Font("Times" & _
"New Roman", 10, FontStyle.Regular), Brushes.Black, y_achse + _
650, x_achse, text_links)
e.Graphics.DrawString(dt.Rows(i)("mobil"), New Font("Times New" & _
"Roman", 10, FontStyle.Regular), Brushes.Black, y_achse + 750, _
x_achse, text_links)
e.Graphics.DrawString(dt.Rows(i)("email"), New Font("Times New" & _
"Roman", 10, FontStyle.Regular), Brushes.Black, y_achse + 850, _
x_achse, text_links)
e.Graphics.DrawString(dt.Rows(i)("geburtstag"), New Font("Times" & _
"New Roman", 10, FontStyle.Regular), Brushes.Black, y_achse + _
1000, x_achse, text_links)
x_achse = x_achse + 30 'abstand von der vorherigen zeile
Else
firstRow = i
e.HasMorePages = True
cn.Close()
Exit Sub
End If
Next
e.Graphics.DrawString("Ausdruck vom :" & " " & aktuellesDatum, New Font( _
"Times New Roman", 10, FontStyle.Regular), Brushes.Black, 60, 750, _
text_links)
cn.Close()
Me.Close() |