Discover Xtrareport element page

Asked

Viewed 73 times

0

In my application, I am generating a report through run time with methods like this below, where print on the screen a label. How could I find out on which page was printed such label? I need to store the page number on a array, for each printable 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);
}

1 answer

1


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

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;
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.