Nueva rutina en tsXtraReports ImprimeInforme
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
Imports System.IO
|
Imports System.IO
|
||||||
|
Imports DevExpress.Xpf.Core
|
||||||
|
Imports DevExpress.Xpf.Grid.Printing
|
||||||
|
Imports DevExpress.XtraPrinting
|
||||||
|
Imports DevExpress.XtraReports.UI
|
||||||
|
|
||||||
Public Class tsXtraReport
|
Public Class tsXtraReport
|
||||||
Public Shared Sub ExportarAPDF(Plantilla() As Byte, Datos As Object, FicheroPDF As String)
|
Public Shared Sub ExportarAPDF(Plantilla() As Byte, Datos As Object, FicheroPDF As String)
|
||||||
@@ -106,4 +110,38 @@ Public Class tsXtraReport
|
|||||||
xr.ExportToPdf(ms)
|
xr.ExportToPdf(ms)
|
||||||
Return ms
|
Return ms
|
||||||
End Function
|
End Function
|
||||||
|
Private Shared NumeroCopias As Integer
|
||||||
|
Friend Shared Sub ImprimeInforme(xr As XtraReport, ImpresoraPredeterminada As Boolean, Copias As Integer, Fecha As Date, Datos As Object)
|
||||||
|
Try
|
||||||
|
For Each pr In xr.Parameters
|
||||||
|
pr.Visible = False
|
||||||
|
If pr.Name = "Fecha" Then
|
||||||
|
pr.Value = Fecha
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
xr.DataSource = Datos
|
||||||
|
xr.CreateDocument(True)
|
||||||
|
If ImpresoraPredeterminada Then
|
||||||
|
If Copias < 2 Then
|
||||||
|
NumeroCopias = 1
|
||||||
|
xr.Print()
|
||||||
|
Else
|
||||||
|
NumeroCopias = Copias
|
||||||
|
AddHandler xr.PrintingSystem.StartPrint, AddressOf xr_StartPring
|
||||||
|
xr.Print()
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
PrintHelper.Print(xr)
|
||||||
|
'xr.PrintDialog()
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
DXMessageBox.Show(ex.Message, "Error")
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Shared Sub xr_StartPring(sender As Object, e As PrintDocumentEventArgs)
|
||||||
|
e.PrintDocument.PrinterSettings.Copies = NumeroCopias
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
Reference in New Issue
Block a user