Exemplo n.º 1
0
        protected void C1WebReport1_StartSection(object sender, C1.C1Report.ReportEventArgs e)
        {
            if (e.Section == C1.C1Report.SectionTypeEnum.Header)
            {
                // get picture field
                C1.C1Report.Field f = this.C1WebReport1.Report.Fields["PictureField"];

                // calculate image size in pixels (convert from twips)
                System.Drawing.Size size = new System.Drawing.Size(
                    (int)(f.Width * 96f / 1440f),
                    (int)(f.Height * 96f / 1440f));

                // get image from webchart and assign it to field
                f.Picture = this.C1WebChart1.GetImage(System.Drawing.Imaging.ImageFormat.Png, size);
            }
        }
Exemplo n.º 2
0
        private void _c1r_StartPage(object sender, C1.C1Report.ReportEventArgs e)
        {
            // first pass, counting pages in each group
            if (_pass == 1)
            {
                // get current country
                string country = (string)_c1r.Evaluate("ShipCountry");

                // update page counters
                if (_groupCounts.Contains(country))
                {
                    _groupCounts[country] = (int)_groupCounts[country] + 1;
                }
                else
                {
                    _groupCounts[country] = 1;
                }

                // user feedback
                statusBar1.Text = string.Format("Counting pages: {0} {1}",
                                                country, _groupCounts[country]);
            }

            // second pass, rendering
            if (_pass == 2)
            {
                // get current country
                string country = (string)_c1r.Evaluate("ShipCountry");

                // get page count for this group (stored during first pass)
                int count = (int)_groupCounts[country];

                // update group count variable used in the report
                _c1r.Execute("groupPageCount = " + count.ToString());

                // user feedback
                int page = (int)(double)_c1r.Evaluate("groupPageCount");
                statusBar1.Text = string.Format("Rendering: {0} page {1} of {2}",
                                                country, page, _groupCounts[country]);
            }
        }