Visual Basic.NET - Ayuda Como agregar mas paginas con e.HasMorePages .NET?

 
Vista:
Imágen de perfil de JORGE

Ayuda Como agregar mas paginas con e.HasMorePages .NET?

Publicado por JORGE (5 intervenciones) el 19/08/2015 02:51:14
Hola soy nuevo en esto de .NET y me he atorado a la hora de querer imprimir con un PrintDocument, quiero imprimir muchas lineas con registros que estoy tomando de un DataGridView pero solo imprime una Hoja y no se en donde agregar el código para meter el e.HasMorePages. Ayuda por favor

Este es mi código:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
        DatGv = Reportes.DataGridView_Registros
        Dim SaltoLn As Integer = 180
        Dim j As Integer = 1
        Dim fechaimp As String
        fechaimp = Date.Now
        nRows = DatGv.RowCount - 1
        e.Graphics.DrawString("Fecha impresión " & fechaimp, SystemFonts.DefaultFont, Brushes.Black, 550, 60)
        e.Graphics.DrawString("REPORTE DE ENTRADAS Y SALIDAS DE PERSONAL GRUPO BACIS", TituloFont, System.Drawing.Brushes.Black, 50, 80)
        e.Graphics.DrawString("Ciudad Industrial", TituloFont, System.Drawing.Brushes.Black, 360, 105)
        e.Graphics.DrawString("Nombre", printFont, System.Drawing.Brushes.Black, 100, 150)
        e.Graphics.DrawString("Apellidos", printFont, System.Drawing.Brushes.Black, 200, 150)
        e.Graphics.DrawString("Depto", printFont, System.Drawing.Brushes.Black, 400, 150)
        e.Graphics.DrawString("Hora", printFont, System.Drawing.Brushes.Black, 500, 150)
        e.Graphics.DrawString("Registro", printFont, System.Drawing.Brushes.Black, 600, 150)
        e.Graphics.DrawString("Fecha", printFont, System.Drawing.Brushes.Black, 700, 150)
        e.Graphics.DrawString("____________________________________________________________", TituloFont, System.Drawing.Brushes.Black, 50, 153)
 
        While nRows > 0
            Dim cel1 = DatGv.CurrentCell.RowIndex + j - 1
            e.Graphics.DrawString(DatGv.Item(Reportes.Nombre.HeaderText, cel1).Value.ToString, SystemFonts.DefaultFont, Brushes.Black, 100, SaltoLn)
            Dim cel2 = DatGv.CurrentCell.RowIndex + j - 1
            e.Graphics.DrawString(DatGv.Item(Reportes.Apellidos.HeaderText, cel2).Value.ToString, SystemFonts.DefaultFont, Brushes.Black, 200, SaltoLn)
            Dim cel3 = DatGv.CurrentCell.RowIndex + j - 1
            e.Graphics.DrawString(DatGv.Item(Reportes.Depto.HeaderText, cel3).Value.ToString, SystemFonts.DefaultFont, Brushes.Black, 400, SaltoLn)
            Dim cel4 = DatGv.CurrentCell.RowIndex + j - 1
            e.Graphics.DrawString(DatGv.Item(Reportes.EntradaSalida.HeaderText, cel4).Value.ToString, SystemFonts.DefaultFont, Brushes.Black, 500, SaltoLn)
            Dim cel5 = DatGv.CurrentCell.RowIndex + j - 1
            e.Graphics.DrawString(DatGv.Item(Reportes.Hora.HeaderText, cel5).Value.ToString, SystemFonts.DefaultFont, Brushes.Black, 600, SaltoLn)
            Dim cel6 = DatGv.CurrentCell.RowIndex + j - 1
            e.Graphics.DrawString(DatGv.Item(Reportes.Fecha.HeaderText, cel6).Value.ToString, SystemFonts.DefaultFont, Brushes.Black, 700, SaltoLn)
            j = j + 1
            SaltoLn = SaltoLn + 20
            nRows = nRows - 1
        End While
 
    End Sub
 
    Private Sub btn_Print_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Print.Click
        PrintDialog1.Document = PrintDocument1
        PrintDialog1.PrinterSettings = PrintDocument1.PrinterSettings
        PrintDialog1.AllowSomePages = True
        If PrintDialog1.ShowDialog = DialogResult.OK Then
            PrintDocument1.PrinterSettings = PrintDialog1.PrinterSettings
            PrintDocument1.Print()
        End If
    End Sub

reporte
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil
Val: 481
Bronce
Ha mantenido su posición en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

Ayuda Como agregar mas paginas con e.HasMorePages .NET?

Publicado por Miguel (476 intervenciones) el 19/08/2015 04:25:38
Hola, creo que éste hilo puede servir...

Saludos,
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de JORGE

Ayuda Como agregar mas paginas con e.HasMorePages .NET?

Publicado por JORGE (5 intervenciones) el 30/08/2015 01:34:03
Gracias por la informacion. segui el concejo de un usuario y al final decidi hacer uso de Crystal report, me resulto mas sencillo
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar