I'm simply trying to print multiple visual items, each to their own page. Using the code below I can easily print a single visual item.
Public Shared Sub PrintVisual(ByVal V As Visual, ByVal orientation As Infragistics.Windows.Reporting.PageOrientation) Dim Report As New Report Dim Section1 As New EmbeddedVisualReportSection(V) Report.Sections.Add(Section1) Report.PageFooter = New TextBlock() With {.Text = My.Application.Info.Description & My.Application.Info.Version.ToString & " - " & DateTime.Now.ToString, .VerticalAlignment = VerticalAlignment.Center, .FontSize = 8} Report.ReportSettings.PageOrientation = orientation Report.ReportSettings.HorizontalPaginationMode = HorizontalPaginationMode.Scale Report.PageHeader = New TextBlock() With {.Text = "DRP - Dynamic Scaling System", .VerticalAlignment = VerticalAlignment.Center, .TextAlignment = TextAlignment.Center, .FontWeight = FontWeights.Bold, .FontSize = 14} Report.Print(True, True) End Sub
I think to print a multipage report I would simply add a FOR loop around the underlined lines of code above like this. Of course the routine now takes in a collection of Visual items.
For each item in V Dim Section1 As New EmbeddedVisualReportSection(item) Report.Sections.Add(Section1)
Next
Unfortunately when I do this and my Visual item collection has more than 1 item in it I get a 'Child belongs to another element error' on the last line of code before End Sub.
I'm sure I'm making a simple mistake but have had no luck trying to search for an answer. I would greatly appreciate some help.
http://es.infragistics.com/community/forums/p/32412/176865.aspx#176865
Based on what Andrew Smith says in the above posting link , it appears that trying to print a multipage report with an object like I am using is not possible.