Deleting pages in the FinalPass
I am trying to pad out a report with a 'Notes' page so as the total number of pages in the report is always a multiple of 4. This is so as the printing company can bind the document easily.
I have tried creating pages at runtime and inserting them into the frxReport.Objects during the OnManualBuild event. This typically results in a "List Index Out of bounds" when the rest of the FR code runs. I saw this post https://forum.fast-report.com/en/discussion/16748/dynamically-pages-in-delphi#latest about swapping pages and that works. I have not found any other posts on dynamically creating pages at runtime though. Is it possible?
What I would like to do is insert pages on the final pass based on whether the number of pages is a multiple of 4: Something like:
LTotalPagesToInsert:=frxReport.Engine.TotalPages mod 4;
if LTotalPagesToInsert>0 then
I've tried adding 3 'Notes' pages to the report designer and then trying to make them visible\invisible according to the number of pages needed to pad the report out. However as the report has a Table of Contents (TOC), its not until the final pass that I know the true number of pages. From what I can see, you can only set a page's visible\invisible property during the first pass.
Has anyone encountedered this issue before and if so, how did you approach it?
Delphi 10.2.3 with FR 2021.0.3.