Page 1 of 1

BeforePrint event not firing

Posted: Mon Sep 21, 2009 9:19 am
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.


BeforePrint event not firing

Posted: Tue Sep 22, 2009 12:12 am
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.