Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
595
Creating a multipage report
posted

I'm simply looking to generate a multipage report but I'm doing something wrong. Using the code below I get an 'Specified element is already the logical child of another element. Disconnect it first.' error on the '   pp.xamReportPreview1.GeneratePreview(Report, False, True)' line. If I comment out either of the bolded lines then it works fine. I haven't had any luck searching around the forum or looking through the user manuals on how to create a multipage report.

 

Public Shared Sub PrintPreview()

        Dim Report As New Report   
        Dim Section1 As New EmbeddedVisualReportSection(New TextBlock)
        Dim Section2 As New EmbeddedVisualReportSection(New TextBlock)
        Report.Sections.Add(Section1)
        Report.Sections.Add(Section2)

 

        Report.PageFooter = New TextBlock() With {.Text = My.Application.Info.Description & My.Application.Info.Version.ToString & " - CONFIDENTIAL INFORMATION - " & DateTime.Now.ToString, .VerticalAlignment = VerticalAlignment.Top, .FontSize = 8}
        Report.ReportSettings.PageOrientation = PageOrientation.Landscape
        Report.ReportSettings.HorizontalPaginationMode = HorizontalPaginationMode.Scale
        Report.PageHeader = New TextBlock() With {.Text = My.Settings.TeamName, .VerticalAlignment = VerticalAlignment.Bottom, .TextAlignment = TextAlignment.Center, .FontWeight = FontWeights.Bold, .FontSize = 14}


        Dim pp As New PrintPreview
     
        pp.xamReportPreview1.GeneratePreview(Report, False, True)


        pp.ShowDialog()
    End Sub

  • 138253
    Offline posted

    Hello,

     

    I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.   

  • 138253
    Offline posted

    Hello,

     

    Thank you for your post. I have been looking into it and the code you have provided and I suggest you set the Page Footer and Header to every section instead of to the Report directly. Please let me know if this helps you or you need further assistance on this matter.

     

    Looking forward for your reply.