Posted 16 July 2020, 7:24 am EST
I have a report in a C1FlexGrid (4.0.20183.343) which should only print certain rows at the tops of pages, so I’m handling the BeforePageBreak event.
private void flex_BeforePageBreak(object sender, RowColEventArgs e)
{
try
{
// this is what I came up with to prevent page breaks midway through a group (without having to keep a dictionary of all the rows)
if (flex.Rows[e.Row].StyleDisplay.BackColor != flex.Styles[_headerStyle].BackColor)
{
e.Cancel = true;
}
}
catch (Exception ex)
{
MainFormBase.ErrorHandler.PersistDisplay(ex);
}
}
I’m currently experiencing an issue where a certain amount of data is causing this event to fire even though the entire report fits on less than half the page. Interestingly, if I comment out the cancellation the report prints on one page.
Why is the event firing when the report can fit on the page, and why is cancelling certain rows causing a page break to be inserted? Documentation on this event says that it is for preventing page breaks, not adding them.