Hi SO!
I'm trying to programmatically set the margins in an active report based on the page number.
Specifically, the first page needs to have small margins (so that the top-most text box with a return address matches the alignment of a company logo) and every page after that should have standard 2.54cm margins.
I've read posts that suggest that detecting the actual page number can be problematic so I've tried using the ReportStart and PageStart handlers along with some very simple logic to set the margins.
In the code-behind for the report, I added the two handlers and bool value:
this.ReportStart += UFAnReportStart;
this.PageStart += UFAnPageStart;
bool bFirstPage = true;
And then added the two callbacks as follows:
private void UFAnReportStart(object sender, System.EventArgs eArgs)
{
this.PageSettings.Margins.Top = 0.1965278F;
}
private void UFAnPageStart(object sender, System.EventArgs eArgs)
{
// every page after the first should have standard margins.
if (!bFirstPage)
{
this.PageSettings.Margins.Top = 2.54F;
}
bFirstPage = false;
}
This doesn't seem to have any effect on the margins. Is this approach just plain wrong? Or is the PageSettings object a report wide property?
Any suggestions for alternative approaches are welcomed.
using Activereports3, version 5.2.1013.2.
Thank you!