Advertisement

06.17.2008 at 06:48AM PDT, ID: 23491457
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.5

ReportViewer Print without Viewing (Need Help Got Start FromAnother Post)

Asked by kspolikoff in Visual Studio, Microsoft Visual Basic.Net, SQL Server 2005

Tags:

report.Render("Image", deviceInfo, AddressOf CreateStream, warnings)

This line gives a LocalProcessingException error
i think my issues is involved with binding my datasource to the report, but i dont know how to fix itStart Free Trial
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:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
Imports System.IO
Imports System.Data
Imports System.Text
Imports System.Drawing.Imaging
Imports System.Drawing.Printing
Imports System.Collections.Generic
Imports Microsoft.Reporting.WinForms
Public Class Reporting
    Implements IDisposable
 
    Public m_currentPageIndex As Integer
    Public m_streams As IList(Of Stream)
 
    Public 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 FileStream("C:\CSB" + name + "." + fileNameExtension, FileMode.Create)
        m_streams.Add(stream)
        Return stream
    End Function
 
    Public Sub Export(ByVal report As LocalReport)
        Dim deviceInfo As String = _
          "<DeviceInfo>" + _
          "  <OutputFormat>EMF</OutputFormat>" + _
          "  <PageWidth>8.5in</PageWidth>" + _
          "  <PageHeight>11in</PageHeight>" + _
          "  <MarginTop>0.25in</MarginTop>" + _
          "  <MarginLeft>0.25in</MarginLeft>" + _
          "  <MarginRight>0.25in</MarginRight>" + _
          "  <MarginBottom>0.25in</MarginBottom>" + _
          "</DeviceInfo>"
        Dim warnings() As Warning = Nothing
        m_streams = New List(Of Stream)()
        report.Render("Image", deviceInfo, AddressOf CreateStream, warnings)
 
        Dim stream As Stream
        For Each stream In m_streams
            stream.Position = 0
        Next
    End Sub
 
    Public Sub PrintPage(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
 
        Dim pageImage As New Metafile(m_streams(m_currentPageIndex))
 
        ev.Graphics.DrawImage(pageImage, ev.PageBounds)
        m_currentPageIndex += 1
        ev.HasMorePages = (m_currentPageIndex < m_streams.Count)
 
    End Sub
 
    Public Sub Print()
 
        Const printerName As String = "Microsoft Office Document Image Writer"
 
        If m_streams Is Nothing OrElse m_streams.Count = 0 Then
            Return
        End If
 
        Dim printDoc As New PrintDocument()
 
        printDoc.PrinterSettings.PrinterName = printerName
 
        If Not printDoc.PrinterSettings.IsValid Then
            Dim msg As String = String.Format( _
                "Can't find printer ""{0}"".", printerName)
            Console.WriteLine(msg)
            Return
        End If
 
        AddHandler printDoc.PrintPage, AddressOf PrintPage
        printDoc.Print()
 
    End Sub
 
    Public Overloads Sub Dispose()
 
        If Not (m_streams Is Nothing) Then
            Dim stream As Stream
            For Each stream In m_streams
                stream.Close()
            Next
            m_streams = Nothing
        End If
 
    End Sub
 
    Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
        Dim report As Microsoft.Reporting.WinForms.LocalReport = New Microsoft.Reporting.WinForms.LocalReport()
 
        Dim myPRT As New Reporting
 
 
        ' Set the physical path to your report rdlc file.      
        report.ReportPath = "C:\Documents and Settings\Kevin\Desktop\CSB Windows\CSB\CSB\Report1.rdlc"
        report.DataSources.Add(New ReportDataSource(Me.ASSIGNTableAdapter.Fill(Me.CSBOLDSQLDataSet.ASSIGN)))
 
        ' This next code prepares the rdlc file for printing and calls the print function from the Reporting class file
        myPRT.Export(report)
        myPRT.m_currentPageIndex = 0
        myPRT.Print()
    End Sub
End Class
[+][-]06.17.2008 at 03:08PM PDT, ID: 21807906

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.18.2008 at 05:43AM PDT, ID: 21812191

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.18.2008 at 05:57AM PDT, ID: 21812280

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.18.2008 at 07:11AM PDT, ID: 21813057

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.22.2008 at 07:43AM PDT, ID: 21840963

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio, Microsoft Visual Basic.Net, SQL Server 2005
Tags: VB.NET 3.5
Sign Up Now!
Solution Provided By: jpaulino
Participating Experts: 1
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628