BeforePrint event not firing

Stimulsoft Reports.WPF discussion
Post Reply
mike_berriman
Posts: 4
Joined: Wed Sep 09, 2009 8:27 pm
Location: Western Australia

BeforePrint event not firing

Post by mike_berriman »


I have the following code :

StiText dataText = new StiText(new RectangleD((count * size), 0, size, 0.5));
dataText.HorAlignment = colInfo.alignment;
dataText.Text = "{" + tableName + "." + col.ColumnName + "}";
dataText.Name = dataBand.Name + "_DataText_" + dataBand.Components.Count;
dataText.GrowToHeight = true;
dataText.BeforePrint += new EventHandler(highlightRowCallback);

void highlightRowCallback(object sender, EventArgs e) {
throw new NotImplementedException();
}

I output the report to file and previewer. Report looks fine - rows and columns contain correct data - but the event never fires. Can you please help understand why this is the case?

I'm using Report.WPF 2009.1

Thanks.

Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

BeforePrint event not firing

Post by Jan »

Hello Mike,

Report can have two states - compiled and not compiled. You need use different ways to sign event handler in this states. If you report is compiled you can use following code:

Code: Select all

StiText text = report.GetComponentByName("Text1") as StiText;
text.BeforePrint += new EventHandler(highlightRowCallback);
If your report is not compiled (default state of report) you should use following code:

Code: Select all

dataText.BeforePrintEvent.Value = "code of this event";
Before compilation all events of reports exist only as strings.

Thank you.
Post Reply