Skip to main content

Accessing Report Elements in Web Form

Version: 6.0

Accessing Report Elements in Web Form

To access any elements defined within the DPLX file, the GetReportElementById method of the DocumentLayout property should be used. After passing in any elements appropriate unique ID, the element returned from the GetReportElementById needs to be cast to its respective type before use. For more information on associating a DPLX file with a Web Form see Using a DPLX file from a Web Form. For accessing report elements from within a non Web Form example see, Using a DPLX file.

The following snippet of code demonstrates how to reference a PageNumberingLabel that was defined in the DPLX file and at runtime change color of the text that will display.

using ceTe.DynamicPDF.ReportWriter;
using ceTe.DynamicPDF.ReportWriter.ReportElements;
...
PageNumberingLabel PageNumberingLabel1 = (PageNumberingLabel)DocumentLayout.GetReportElementById( "PageNumberingLabel1" );
PageNumberingLabel1.TextColor = ceTe.DynamicPDF.RgbColor.Red;
DrawPdfToWeb("NewReport.pdf");
Imports ceTe.DynamicPDF.ReportWriter
Imports ceTe.DynamicPDF.ReportWriter.ReportElements
...
Dim MyPageNumberingLabel As PageNumberingLabel = CType(DocumentLayout.GetReportElementById("PageNumberingLabel1"), PageNumberingLabel)
MyPageNumberingLabel.TextColor = ceTe.DynamicPDF.RgbColor.Red
DrawPdfToWeb("NewReport.pdf")