Here are the way by which we can add controls dynamically to report.
(1) Declare DetailReportBand and DetailBand
DetailReportBand detailReportBand = new DetailReportBand();
DetailBand subDetailBaind = new DetailBand();
(2) Create any devexpress control you want to add. For e.g
- To load image dynamically, we can do so below way..
XRPictureBox xrPictureBox = new XRPictureBox();
xrPictureBox.Image = "image path";
xrPictureBox.Sizing = DevExpress.XtraPrinting.ImageSizeMode.ZoomImage;
xrPictureBox.SizeF = new SizeF(50, 50);
xrPictureBox.LocationFloat = new DevExpress.Utils.PointFloat(0F, 50F);
- To load pagebreak dynamically
XRPageBreak xrPageBreak = new XRPageBreak();
(3) add picture box to subDetailBand
- add picturebox dynamically
subDetailBaind.Controls.Add(xrPictureBox);
- add pagebreak dynamically
subDetailBaind.Controls.Add(xrPageBreak);
(4) add subDetailBand to detailBandReport
detailReportBand.Bands.Add(subDetailBaind);
(5) add detailReportBand to your repor
mainReport mymainReport = new mainReport();
mymainReport.Bands.Add(detailReportBand);
For this example, we have added XRPictureBox & XRPageBreak, but you can declare any DevExpress control to step - (2) and load them dynamically to your report then after performing step - (3) onwards.
(1) Declare DetailReportBand and DetailBand
DetailReportBand detailReportBand = new DetailReportBand();
DetailBand subDetailBaind = new DetailBand();
(2) Create any devexpress control you want to add. For e.g
- To load image dynamically, we can do so below way..
XRPictureBox xrPictureBox = new XRPictureBox();
xrPictureBox.Image = "image path";
xrPictureBox.Sizing = DevExpress.XtraPrinting.ImageSizeMode.ZoomImage;
xrPictureBox.SizeF = new SizeF(50, 50);
xrPictureBox.LocationFloat = new DevExpress.Utils.PointFloat(0F, 50F);
- To load pagebreak dynamically
XRPageBreak xrPageBreak = new XRPageBreak();
(3) add picture box to subDetailBand
- add picturebox dynamically
subDetailBaind.Controls.Add(xrPictureBox);
- add pagebreak dynamically
subDetailBaind.Controls.Add(xrPageBreak);
(4) add subDetailBand to detailBandReport
detailReportBand.Bands.Add(subDetailBaind);
(5) add detailReportBand to your repor
mainReport mymainReport = new mainReport();
mymainReport.Bands.Add(detailReportBand);
For this example, we have added XRPictureBox & XRPageBreak, but you can declare any DevExpress control to step - (2) and load them dynamically to your report then after performing step - (3) onwards.
No comments:
Post a Comment