Active Reports - Find out what page a control is on before the final print

900 views Asked by At

I need to find out what page a control is on after all the report data has been added. Depending on how much data has been added above (e.g. table rows), the control could be on page 1, 2 or even 3. The reason for needing the page number is to find out if that control straddles two pages. If it does then I want to nudge it down enough to make sure its not split over two pages

As the control in question is dynamically added during the ReportStart event I can't tell what page it will ultimately end up on as the report data hasn't been added yet.

I'm pretty sure i'll be able to do this in the Detail_BeforePrint event as it fires for each page of the report and this.PageNumber gives the current page.

Inside Detail_BeforePrint I can find the control using:

    var myControl= this.Detail.Controls["MyControl"];

But myControl does not have any properties that might suggest what page its on. Can anyone help?

I'm using Active Reports 6 and Visual Studio 2010

1

There are 1 answers

1
IssamElbaytam On

What you're asking for is not possible to find out. You can retrieve the pageNumber from the report but that would tell you the last page the control will print to. The control does not have a page number because it is possible for it to print on more than one page.

However with that said, it is possible to get the effect you want using KeepTogether property. if you set it to true, AR will always try to keep the control on a single page and move it automatically for you. And it handles the case where the length of the control might more than a single page so it wouldn't need to be moved since that would have no effect. Hope this helps.