private void _report_StartPage(object sender, C1.C1Report.ReportEventArgs e) { // get report name string reportName = _report.ReportName; if (reportName == null || reportName.Length == 0) { reportName = "Report"; } // get current progress int progress = (int)((_report.Page * 100) / _pageCount); // correct if caller underestimated page count while (progress > 100) { _pageCount = (_pageCount * 130) / 100; progress = (int)((_report.Page * 100) / _pageCount); } // update progress on new page _lblPage.Text = string.Format("Rendering page {0} of '{1}'...", _report.Page, _report.ReportName); _progress.Value = progress; }
private void _c1r_PrintSection(object sender, C1.C1Report.ReportEventArgs e) { // get the field we want Field theField = _c1r.Fields["SalesChart"]; // make sure this is the section we want if (e.Section != theField.Section) { return; } // create chart image for this section using (DataView chartData = new DataView(_dataTable)) { // filter chart data for the current category chartData.RowFilter = "CategoryName = '" + _c1r.Evaluate("CategoryName") + "'"; // create chart Image img = BuildChart(chartData); // add chart image to field theField.Picture = img; theField.Text = string.Empty; } }
// The PrintSection event gets fired after the fields in the section have been // evaluated, and before they are rendered. it's a good place to change colors, // fonts, etc. based on values read from the database. // private void _c1r_PrintSection(object sender, C1.C1Report.ReportEventArgs e) { if (e.Section == SectionTypeEnum.Detail) { foreach (Field f in _c1r.Sections[SectionTypeEnum.Detail].Fields) { if (f.Value is int) { int i = (int)f.Value; int min = 300; int max = 700; if (i < min) { f.ForeColor = Colors.DarkRed; } else if (i > max) { f.ForeColor = Colors.DarkBlue; } else { f.ForeColor = Colors.Black; } } } } }
// update UI private void _c1r_StartPage(object sender, C1.C1Report.ReportEventArgs e) { _status.Text = string.Format("Rendering page {0}", _c1r.Page); }
// trace errors private void c1Report1_ReportError(object sender, C1.C1Report.ReportEventArgs e) { Console.WriteLine("** error: {0}", e.Exception.Message); }
private void c1Report1_StartPage(object sender, C1.C1Report.ReportEventArgs e) { ShowStatus(string.Format("[{0}]: Rendering page {1}", c1Report1.ReportName, e.Page)); }