Splitting dynamically generated columns across pages

Posted by: sstoecker on 22 January 2021, 4:36 pm EST

    • Post Options:
    • Link

    Posted 22 January 2021, 4:36 pm EST - Updated 30 September 2022, 4:50 pm EST

    I have a report consisting of mostly dynamically-generated columns - only three are defined in the report while possibly dozens could be generated at runtime. The code below generates them, with totalNames being populated from a DataTable of unique column names. I just loop through the list and add them to the first (header) section:

                List<string> totalNames = new List<string>();
    
                for (int i = 0; i < totalNames.Count - 1; i++)
                {
                    ctl = new GrapeCity.ActiveReports.SectionReportModel.Label();
                    ctl.Name = "header1" + i.ToString();
                    ctl.Location = new PointF(left + (i * 0.3f), 0.8f);
                    ctl.Size = new SizeF(0.3f, .3f);
    
                    ar.Sections[0].Controls.Add(ctl);
                }
    

    This works, but my issue is that if there are more than about twenty columns (and this is very likely), they run off the screen and are no longer visible. Is there a way to tell the report to split the columns across pages, so if the number of columns exceeded a certain count (i.e. 20 columns), then the remaining columns would appear on the second page?

    I had been experimenting with the blog post at https://www.grapecity.com/blogs/generate-columns-at-runtime-in-activereports, and that did show me how to properly generate the columns. I was not able to successfully duplicate splitting the columns across pages. This may be something I had done wrong, or that the example project is ten years old and is a Windows Form project, while I am using WPF.

  • Posted 25 January 2021, 1:00 am EST

    Hello,

    SectionReport does not have page system, therefore you cannot split the column in the two page. Can you increase report page width as per the number of the column so that every column fit in one page.

    they run off the screen and are no longer visible.

    Are you previewing the report in the Viewer? In my understanding, it should appear in the viewer even if it does not fit in one Page.

    Thanks,

    Mohit

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels