Return to site

Imprimir Sin Vista Previa Crystal Reports

broken image


11/09/2014, 10:44
Mensajes: 44
Puntos: 0
He encontrado este código que lo da microsoft para imprimir un reporte .rdlc sin vista previa, pero por más vueltas que le doy no se hacerlo funcionar..
Este es el código:
Imports System
Imports System.IO
Imports System.Data
Imports System.Text
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Drawing.Printing
Imports System.Collections.Generic
Imports System.Windows.Forms
Imports Microsoft.Reporting.WinForms
Public Class Demo
Implements IDisposable
Private m_currentPageIndex As Integer
Private m_streams As IList(Of Stream)
Private Function LoadSalesData() As DataTable
' Create a new DataSet and read sales data file
' data.xml into the first DataTable.
Dim dataSet As New DataSet()
dataSet.ReadXml('..data.xml')
Return dataSet.Tables(0)
End Function
' Routine to provide to the report renderer, in order to
' save an image for each page of the report.
Private Function CreateStream(ByVal name As String, ByVal fileNameExtension As String, ByVal encoding As Encoding, ByVal mimeType As String, ByVal willSeek As Boolean) As Stream
Dim stream As Stream = New MemoryStream()
m_streams.Add(stream)
Return stream
End Function
' Export the given report as an EMF (Enhanced Metafile) file.
Private Sub Export(ByVal report As LocalReport)
Dim deviceInfo As String = '' & _
'EMF' & _
'8.5in' & _
'11in' & _
'0.25in' & _
'0.25in' & _
'0.25in' & _
'0.25in' & _
''
Dim warnings As Warning()
m_streams = New List(Of Stream)()
report.Render('Image', deviceInfo, AddressOf CreateStream, warnings)
For Each stream As Stream In m_streams
stream.Position = 0
Next
End Sub
' Handler for PrintPageEvents
Private Sub PrintPage(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
Dim pageImage As New Metafile(m_streams(m_currentPageIndex))
' Adjust rectangular area with printer margins.
Dim adjustedRect As New Rectangle(ev.PageBounds.Left - CInt(ev.PageSettings.HardMarginX), _
ev.PageBounds.Top - CInt(ev.PageSettings.HardMarginY), _
ev.PageBounds.Width, _
ev.PageBounds.Height)
' Draw a white background for the report
ev.Graphics.FillRectangle(Brushes.White, adjustedRect)
' Draw the report content
ev.Graphics.DrawImage(pageImage, adjustedRect)
' Prepare for the next page. Make sure we haven't hit the end.
m_currentPageIndex += 1
ev.HasMorePages = (m_currentPageIndex < m_streams.Count)
End Sub
Private Sub Print()
If m_streams Is Nothing OrElse m_streams.Count = 0 Then
Throw New Exception('Error: no stream to print.')
End If
Dim printDoc As New PrintDocument()
If Not printDoc.PrinterSettings.IsValid Then
Throw New Exception('Error: cannot find the default printer.')
Else
AddHandler printDoc.PrintPage, AddressOf PrintPage
m_currentPageIndex = 0
printDoc.Print()
End If
End Sub
' Create a local report for Report.rdlc, load the data,
' export the report to an .emf file, and print it.
Private Sub Run()
Dim report As New LocalReport()
report.ReportPath = '..Report.rdlc'
report.DataSources.Add(New ReportDataSource('Sales', LoadSalesData()))
Export(report)
Print()
End Sub
Public Sub Dispose() Implements IDisposable.Dispose
If m_streams IsNot Nothing Then
For Each stream As Stream In m_streams
stream.Close()
Next
m_streams = Nothing
End If
End Sub
Public Shared Sub Main(ByVal args As String())
Using demo As New Demo()
demo.Run()
End Using
End Sub
End Class
Si alguien me pudiera hechar una mano.se lo agradecería mil

I am populating data in Crystal Report using SQL Server stored procedures. I was able to achieve my desired printing output using parameters passing and formatting each column using formula in CR.

Imprimir sin vista previa crystal reports california

In printing reports, the usual process is it will preview the created / generated output in Crystal Report Viewer, then, there are the print, export options where it will convert first the report to PDF to proceed to the printing functions

What I want is when I click the print button, It will automatically lead to printing procedures. Hino explorer keygen crack generator.

I was lead to this link for the answer How to print crystal report directly to a client machine using C# Asp.net

code, others also suggesting to fill the dataset in page init, but I am seem lost on how to do it.

Imprimir Sin Vista Previa Crystal Reports California

This is my currently working code (the usual printing process where it will lead you first to the Crystal Report preview.

Reports

In printing reports, the usual process is it will preview the created / generated output in Crystal Report Viewer, then, there are the print, export options where it will convert first the report to PDF to proceed to the printing functions

What I want is when I click the print button, It will automatically lead to printing procedures. Hino explorer keygen crack generator.

I was lead to this link for the answer How to print crystal report directly to a client machine using C# Asp.net

code, others also suggesting to fill the dataset in page init, but I am seem lost on how to do it.

Imprimir Sin Vista Previa Crystal Reports California

This is my currently working code (the usual printing process where it will lead you first to the Crystal Report preview.

UPDATED:

Imprimir Sin Vista Previa Crystal Reports Texas

I just needed this to update for clarification purposes that the accepted answer below will work only on server side. Meaning when user is accessing the server remotely, the code will not work.

Estoy desarrollando un sistema para una corralon y necesito imprimir facturas A y B en diferentes impresoras, sin cuadros de dialogo para elegir la impresora ni vista previa, necesito que solo imprima la factura, hasta ahora no he podido hacer esto. Professional audio editing software free full version.

Imprimir Sin Vista Previa Crystal Reports 2016

Dec 12, 2011. Imprimir Sin Vista Previa Crystal Reports; Fifa 07 Classic Teams Patch; Download Killer Bean Unleashed Mod Apk Unlimited; Vacanze Di Natale 2000 Film Completo Dailymotion; 2pac R U Still Down Album Download Zip; Manual Gimnasia Basica Americana; Install Root Enumerated Driver Live Suite Windows.





broken image