none
Print RDLC Report Directly to Printer with SubReports!

    Question

  • I am currently printing a report directly to the default printer using the code from this link. 

    http://msdn.microsoft.com/en-us/library/ms252091%28v=vs.100%29.aspx

    However I have now changed the report to use three subreports and I am wondering if anyone knows how to do that.  When I use the reportviewer I had to add the code

    AddHandler ReportViewer1.LocalReport.SubreportProcessing, AddressOf SubreportProcessingEventHandler

    and the this code:

    Public Sub SubreportProcessingEventHandler(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)
            Dim zrpt = e.ReportPath
    
            Select Case zrpt
                Case "WOPartsSubReport"
                    Dim ds1 As New WOPartsSubReportDataSet
                    Dim da1 As New WOPartsSubReportDataSetTableAdapters.wopartsTableAdapter
                    da1.Fill(ds1.woparts)
    
                    e.DataSources.Add(New ReportDataSource("DataSet1", ds1.Tables("woparts")))
    
                Case "WOLaborSubReport"
                    Dim ds2 As New WOLaborSubReportDataSet
                    Dim da2 As New WOLaborSubReportDataSetTableAdapters.wolaborTableAdapter
                    da2.Fill(ds2.wolabor)
    
                    e.DataSources.Add(New ReportDataSource("DataSet1", ds2.Tables("wolabor")))
    
                Case "WOLockoutSubReport"
                    Dim ds As New WOLockOutSubReportDataSet
                    Dim da As New WOLockOutSubReportDataSetTableAdapters.wolockTableAdapter
                    da.Fill(ds.wolock)
    
                    e.DataSources.Add(New ReportDataSource("DataSet1", ds.Tables("wolock")))
    
            End Select
        End Sub

    But now that I am NOT using a reportviewer how can I still get the subreports to work and still print directly to the printer?  Where would I put the code to do that?

    Thanks,

    Stacy

    Monday, July 01, 2013 12:16 PM

All replies

  • Hi Stacy,

    Thank you for your question. 

    I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated. 

    Thank you for your understanding and support.

    Regards,
    Charlie Liao

    If you have any feedback on our support, please click here.


    Charlie Liao
    TechNet Community Support

    Tuesday, July 02, 2013 6:39 AM
  • Hello Stacy,

    I am not sure what you mean with "not using a reportviewer"
    Microsoft.Reporting.WinForms is the ReportViewer Windows forms control.

    Do you get a specific error or see some issue when trying to print the report with the subreports?

    Regards,
    Orsi
    Microsoft Online Community Support
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Tuesday, August 06, 2013 10:35 AM