Discover XtraReport element page

0

In my application, I am generating a report using run time with methods like this below, where I start on the screen a label . How could I find out which page was printed on label ? I need to store the page number in an array , for each printed label.

private static void AddLabelToXtraReport(XtraDadosEmpresa relatorio, String titulo, int tamanho)
{
    XRLabel Titulo = new XRLabel();
    Titulo.WidthF = 790f;
    Titulo.Text = titulo;
    Titulo.TextAlignment = DevExpress.XtraPrinting.TextAlignment.BottomCenter;
    Titulo.Font = new Font("Times New Roman", tamanho, FontStyle.Bold);

    DevExpress.XtraReports.UI.DetailReportBand detailReportBand = new DetailReportBand();
    relatorio.Bands.Add(detailReportBand);

    DevExpress.XtraReports.UI.DetailBand novaBand = new DetailBand();
    novaBand.HeightF = Titulo.HeightF + 10F;
    detailReportBand.Bands.Add(novaBand);

    novaBand.Controls.Add(Titulo);
}
    
asked by anonymous 03.05.2018 / 18:51

1 answer

1

I got through the PrintOnPage method of the element I wanted to know the page of.

private static void AddLabelToXtraReport(XtraDadosEmpresa relatorio, String titulo, int tamanho){

    ...

    Titulo.PrintOnPage += new PrintOnPageEventHandler(Titulo_PrintOnPage);
}

static void Titulo_PrintOnPage(object sender, PrintOnPageEventArgs e)
{
    int NumeroPagina = e.PageIndex;
}
    
04.05.2018 / 16:16