Exemplo n.º 1
0
        public Page RunPageNew(Pages pgs, Page p)
        {
            if (p.IsEmpty())                                    // if the page is empty it won't help to create another one
            {
                return(p);
            }

            // Do we need a new page or have should we fill out more body columns
            Body b    = OwnerReport.Body;
            int  ccol = b.IncrCurrentColumn(pgs.Report);        // bump to next column

            float top = OwnerReport.TopOfPage;                  // calc top of page

            if (ccol < b.Columns)
            {                           // Stay on same page but move to new column
                p.XOffset =
                    ((OwnerReport.Width.Points + b.ColumnSpacing.Points) * ccol);
                p.YOffset = top;
                p.SetEmpty();                                   // consider this page empty
            }
            else
            {                           // Go to new page
                b.SetCurrentColumn(pgs.Report, 0);
                pgs.NextOrNew();
                p         = pgs.CurrentPage;
                p.YOffset = top;
                p.XOffset = 0;
            }

            return(p);
        }
Exemplo n.º 2
0
 public void RunPageRegionEnd(Pages pgs)
 {
     if (this.TC == null && this.PageBreakAtEnd && !pgs.CurrentPage.IsEmpty())
     {                   // force page break at beginning of dataregion
         pgs.NextOrNew();
         pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
     }
 }
Exemplo n.º 3
0
        override public void RunPage(Pages pgs, Row row)
        {
            Report r       = pgs.Report;
            bool   bHidden = IsHidden(r, row);

            SetPagePositionBegin(pgs);

            // Handle page breaking at start
            if (this.PageBreakAtStart && !IsTableOrMatrixCell(r) && !pgs.CurrentPage.IsEmpty() && !bHidden)
            {   // force page break at beginning of dataregion
                pgs.NextOrNew();
                pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
            }

            PageRectangle pr = new PageRectangle();

            SetPagePositionAndStyle(r, pr, row);
            if (pr.SI.BackgroundImage != null)
            {
                pr.SI.BackgroundImage.H = pr.H;                         //   and in the background image
            }
            if (!bHidden)
            {
                Page p = pgs.CurrentPage;
                p.AddObject(pr);

                if (_ReportItems != null)
                {
                    float saveY = p.YOffset;
                    //             p.YOffset += (Top == null ? 0 : this.Top.Points);
                    p.YOffset = pr.Y;       // top of rectangle is base for contained report items
                    _ReportItems.RunPage(pgs, row, GetOffsetCalc(pgs.Report) + LeftCalc(r));
                    p.YOffset = saveY;
                }

                // Handle page breaking at end
                if (this.PageBreakAtEnd && !IsTableOrMatrixCell(r) && !pgs.CurrentPage.IsEmpty())
                {       // force page break at beginning of dataregion
                    pgs.NextOrNew();
                    pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
                }
            }
//			SetPagePositionEnd(pgs, pgs.CurrentPage.YOffset);
            SetPagePositionEnd(pgs, pr.Y + pr.H);
        }
Exemplo n.º 4
0
		override public void RunPage(Pages pgs, Row row)
		{
			Report rpt = pgs.Report;

			if (IsHidden(pgs.Report, row))
				return;

			_ChartMatrix.RunReset(rpt);
			Rows _Data = GetFilteredData(rpt, row);
			SetMyData(rpt, _Data);

			SetPagePositionBegin(pgs);

			if (!AnyRowsPage(pgs, _Data))		// if no rows return
				return;						//   nothing left to do

			// Build the Chart bitmap, along with data regions
			Page p = pgs.CurrentPage;
			ChartBase cb=null;
			try
			{
				cb = RunChartBuild(rpt, row);					// Build the chart
                if (!_isHYNEsWonderfulVector.EvaluateBoolean(rpt,row)) //AJM GJL 14082008 'Classic' Rendering 
                {
                    System.Drawing.Image im = cb.Image(rpt);	// Grab the image
                    int height = im.Height;							// save height and width
                    int width = im.Width;

                    MemoryStream ostrm = new MemoryStream();
                    /* The following is a new image saving logic which will allow for higher 
                     * quality images using JPEG with 100% quality
                     * 06122007AJM */
                    System.Drawing.Imaging.ImageCodecInfo[] info;
                    info = ImageCodecInfo.GetImageEncoders();
                    EncoderParameters encoderParameters;
                    encoderParameters = new EncoderParameters(1);
                    // 20022008 AJM GJL - Centralised class with global encoder settings
                    encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, ImageQualityManager.ChartImageQuality);
                    System.Drawing.Imaging.ImageCodecInfo codec = null;
                    for (int i = 0; i < info.Length; i++)
                    {
                        if (info[i].FormatDescription == "JPEG")
                        {
                            codec = info[i];
                            break;
                        }
                    }
                    im.Save(ostrm, codec, encoderParameters);
                    // 06122007AJM The follow has been replaced with the code above
                    //im.Save(ostrm, info);	// generate a jpeg   TODO: get png to work with pdf

                    byte[] ba = ostrm.ToArray();
                    ostrm.Close();
                    PageImage pi = new PageImage(IMAGEFORMAT, ba, width, height);	// Create an image

                    RunPageRegionBegin(pgs);

                    SetPagePositionAndStyle(rpt, pi, row);
                    pi.SI.BackgroundImage = null;	// chart already has the background image

                    if (pgs.CurrentPage.YOffset + pi.Y + pi.H >= pgs.BottomOfPage && !pgs.CurrentPage.IsEmpty())
                    {	// force page break if it doesn't fit on the page
                        pgs.NextOrNew();
                        pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
                        if (this.YParents != null)
                            pi.Y = 0;
                    }

                    p = pgs.CurrentPage;

                    p.AddObject(pi);	// Put image onto the current page

                    RunPageRegionEnd(pgs);

                    if (!this.PageBreakAtEnd && !IsTableOrMatrixCell(rpt))
                    {
                        float newY = pi.Y + pi.H;
                        p.YOffset += newY;	// bump the y location
                    }
                    SetPagePositionEnd(pgs, pi.Y + pi.H);
                }
                else //Ultimate Rendering - Vector //AJM GJL 14082008
                {
                    System.Drawing.Imaging.Metafile im = cb.Image(rpt);	// Grab the image
                    //im could still be saved to a bitmap at this point
                    //if we were to offer a choice of raster or vector, it would probably
                    //be easiest to draw the chart to the EMF and then save as bitmap if needed
                    int height = im.Height;							// save height and width
                    int width = im.Width;
                    byte[] ba = cb._aStream.ToArray();
                    cb._aStream.Close();

                    PageImage pi = new PageImage(ImageFormat.Wmf, ba, width, height);
                    RunPageRegionBegin(pgs);

                    SetPagePositionAndStyle(rpt, pi, row);
                    pi.SI.BackgroundImage = null;	// chart already has the background image

                    if (pgs.CurrentPage.YOffset + pi.Y + pi.H >= pgs.BottomOfPage && !pgs.CurrentPage.IsEmpty())
                    {	// force page break if it doesn't fit on the page
                        pgs.NextOrNew();
                        pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
                        if (this.YParents != null)
                            pi.Y = 0;
                    }

                    p = pgs.CurrentPage;

                    //GJL 25072008 - Charts now draw in EMFplus format and not in bitmap. Still using the "PageImage" for the positioning
                    //paging etc, but we don't add it to the page.
                    // ******************************************************************************************************************
                    // New EMF Processing... we want to add the EMF Components to the page and not the actual EMF...
                    EMF emf = new EMF(pi.X, pi.Y, width, height);
                    emf.ProcessEMF(ba); //Process takes the bytearray of EMFplus data and breaks it down into lines,ellipses,text,rectangles
                    //etc... There are still a lot of GDI+ functions I haven't got to (and some I have no intention of getting to!). 
                    foreach (PageItem emfItem in emf.PageItems)
                    {
                        p.AddObject(emfItem);

                    }
                    // ******************************************************************************************************************

                    //p.AddObject(pi);
                    RunPageRegionEnd(pgs);
                    pi.Y += p.YOffset;
                    if (!this.PageBreakAtEnd && !IsTableOrMatrixCell(rpt))
                    {
                        float newY = pi.Y + pi.H;
                        p.YOffset += newY;	// bump the y location
                    }
                    SetPagePositionEnd(pgs, pi.Y + pi.H); //our emf size seems to be bigger than the jpeg...
          
                }
            }
			catch (Exception ex)
			{
				rpt.rl.LogError(8, string.Format("Exception in Chart handling.\n{0}\n{1}", ex.Message, ex.StackTrace));
			}
			finally
			{
				if (cb != null)
					cb.Dispose();
			}

            return;
		}
Exemplo n.º 5
0
		override public void RunPage(Pages pgs, Row row)
		{
			Report r = pgs.Report;
            bool bHidden = IsHidden(r, row);

			SetPagePositionBegin(pgs);

            // Handle page breaking at start
            if (this.PageBreakAtStart && !IsTableOrMatrixCell(r) && !pgs.CurrentPage.IsEmpty() && !bHidden)
            {	// force page break at beginning of dataregion
                pgs.NextOrNew();
                pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
            }

			PageRectangle pr = new PageRectangle();
			SetPagePositionAndStyle(r, pr, row);
			if (pr.SI.BackgroundImage != null)
				pr.SI.BackgroundImage.H = pr.H;		//   and in the background image

            if (!bHidden)
            {
                Page p = pgs.CurrentPage;
                p.AddObject(pr);

                if (_ReportItems != null)
                {
                    float saveY = p.YOffset;
       //             p.YOffset += (Top == null ? 0 : this.Top.Points);
                    p.YOffset = pr.Y;       // top of rectangle is base for contained report items
                    _ReportItems.RunPage(pgs, row, GetOffsetCalc(pgs.Report) + LeftCalc(r));
                    p.YOffset = saveY;
                }

                // Handle page breaking at end
                if (this.PageBreakAtEnd && !IsTableOrMatrixCell(r) && !pgs.CurrentPage.IsEmpty())
                {	// force page break at beginning of dataregion
                    pgs.NextOrNew();
                    pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
                }
            }
//			SetPagePositionEnd(pgs, pgs.CurrentPage.YOffset);
            SetPagePositionEnd(pgs, pr.Y + pr.H);
        }
        override public void RunPage(Pages pgs, Row row)
        {
            Report rpt = pgs.Report;

            if (IsHidden(pgs.Report, row))
            {
                return;
            }

            SetPagePositionBegin(pgs);

            // Build the Chart bitmap, along with data regions
            Page p = pgs.CurrentPage;
            ICustomReportItem cri = null;
            Bitmap            bm  = null;

            try
            {
                cri = RdlEngineConfig.CreateCustomReportItem(_Type);
                SetProperties(pgs.Report, row, cri);

                int width = WidthCalc(rpt, pgs.G) -
                            (Style == null? 0 :
                             (Style.EvalPaddingLeftPx(rpt, row) + Style.EvalPaddingRightPx(rpt, row)));
                int height = RSize.PixelsFromPoints(this.HeightOrOwnerHeight) -
                             (Style == null? 0 :
                              (Style.EvalPaddingTopPx(rpt, row) + Style.EvalPaddingBottomPx(rpt, row)));
                bm = new Bitmap(width, height);
                cri.DrawImage(bm);

                MemoryStream ostrm = new MemoryStream();
                // 06122007AJM Changed to use high quality JPEG encoding
                //bm.Save(ostrm, IMAGEFORMAT);	// generate a jpeg   TODO: get png to work with pdf
                System.Drawing.Imaging.ImageCodecInfo[] info;
                info = ImageCodecInfo.GetImageEncoders();
                EncoderParameters encoderParameters;
                encoderParameters = new EncoderParameters(1);
                // 20022008 AJM GJL - Using centralised image quality
                encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, ImageQualityManager.CustomImageQuality);
                System.Drawing.Imaging.ImageCodecInfo codec = null;
                for (int i = 0; i < info.Length; i++)
                {
                    if (info[i].FormatDescription == "JPEG")
                    {
                        codec = info[i];
                        break;
                    }
                }
                bm.Save(ostrm, codec, encoderParameters);

                byte[] ba = ostrm.ToArray();
                ostrm.Close();
                PageImage pi = new PageImage(IMAGEFORMAT, ba, width, height);   // Create an image
                pi.Sizing = ImageSizingEnum.Clip;
//                RunPageRegionBegin(pgs);

                SetPagePositionAndStyle(rpt, pi, row);

                if (pgs.CurrentPage.YOffset + pi.Y + pi.H >= pgs.BottomOfPage && !pgs.CurrentPage.IsEmpty())
                {       // force page break if it doesn't fit on the page
                    pgs.NextOrNew();
                    pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
                    if (this.YParents != null)
                    {
                        pi.Y = 0;
                    }
                }

                p = pgs.CurrentPage;

                p.AddObject(pi);        // Put image onto the current page

                //              RunPageRegionEnd(pgs);

                if (!this.PageBreakAtEnd && !IsTableOrMatrixCell(rpt))
                {
                    float newY = pi.Y + pi.H;
                    p.YOffset += newY;  // bump the y location
                }
                SetPagePositionEnd(pgs, pi.Y + pi.H);
            }
            catch (Exception ex)
            {
                rpt.rl.LogError(8, string.Format("Exception in CustomReportItem handling: {0}", ex.Message));
            }
            finally
            {
                if (cri != null)
                {
                    cri.Dispose();
                }
            }

            return;
        }
Exemplo n.º 7
0
        override public void RunPage(Pages pgs, Row row)
        {
            Report         r   = pgs.Report;
            TextboxRuntime tbr = TextboxRuntime.GetTextboxRuntime(r, this);

            tbr.RunCount++;                     // Increment the run count

            bool bHidden = IsHidden(r, row);

            SetPagePositionBegin(pgs);

            string t;

            if (bHidden)
            {
                t = "";
            }
            else
            {
                t = RunText(r, row);    // get the text
            }
            bool bDup = RunTextIsDuplicate(tbr, t, pgs.CurrentPage);

            if (bDup)
            {
                if (!(this.IsTableOrMatrixCell(r)))                     // don't put out anything if not in Table or Matrix
                {
                    bHidden = true;
                }
                t = "";                         // still need to put out the cell
            }
            PageText     pt;
            PageTextHtml pth = null;

            if (IsHtml(r, row))
            {
                pt = pth = new PageTextHtml(t);
            }
            else
            {
                pt = new PageText(t);
            }
            SetPagePositionAndStyle(r, pt, row);
            if (this.CanGrow && tbr.RunHeight == 0)             // when textbox is in a DataRegion this will already be called
            {
                this.RunTextCalcHeight(r, pgs.G, row, pt is PageTextHtml? pt as PageTextHtml: null);
            }
            pt.H = Math.Max(pt.H, tbr.RunHeight);                       // reset height
            if (pt.SI.BackgroundImage != null)
            {
                pt.SI.BackgroundImage.H = pt.H;                         //   and in the background image
            }
            pt.CanGrow = this.CanGrow;

            // check TextAlign: if General then correct based on data type
            if (pt.SI.TextAlign == TextAlignEnum.General)
            {
                if (DataType.IsNumeric(this.Value.GetTypeCode()))
                {
                    pt.SI.TextAlign = TextAlignEnum.Right;
                }
            }

            // Hidden objects don't affect the current page?
            if (!bHidden)
            {
                // Force page break if it doesn't fit on a page
                if (this.IsInBody &&                                             // Only force page when object directly in body
                    pgs.CurrentPage.YOffset + pt.Y + pt.H >= pgs.BottomOfPage && // running off end of page
                    !pgs.CurrentPage.IsEmpty())                                  // if page is already empty don't force new
                {                                                                // force page break if it doesn't fit on the page
                    pgs.NextOrNew();
                    pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
                    if (this.YParents != null)
                    {
                        pt.Y = 0;
                    }
                }

                Page p = pgs.CurrentPage;
                RecordPageReference(r, p, row);                 // save information for late page header/footer references
                p.AddObject(pt);
                if (!bDup)
                {
                    tbr.PreviousText = t;       // previous text displayed
                    tbr.PreviousPage = p;       //  page previous text was shown on
                }
            }

            SetPagePositionEnd(pgs, pt.Y + pt.H);
            if (pth != null)
            {
                pth.Reset();
            }
            if (this.CanGrow && !Value.IsConstant())
            {
                tbr.RunHeight = 0;                                                      // need to recalculate
            }
        }
        override public void RunPage(Pages pgs, Row row)
        {
            Report rpt = pgs.Report;

            if (IsHidden(pgs.Report, row))
                return;

            SetPagePositionBegin(pgs);

            // Build the Chart bitmap, along with data regions
            Page p = pgs.CurrentPage;
            ICustomReportItem cri = null;
            Bitmap bm = null;
            try
            {
                cri = RdlEngineConfig.CreateCustomReportItem(_Type);
                SetProperties(pgs.Report, row, cri);
                
                int width = WidthCalc(rpt, pgs.G) - 
                    (Style == null? 0 :
                        (Style.EvalPaddingLeftPx(rpt, row) + Style.EvalPaddingRightPx(rpt, row)));
                int height = RSize.PixelsFromPoints(this.HeightOrOwnerHeight) -
                    (Style == null? 0 :
                        (Style.EvalPaddingTopPx(rpt, row) + Style.EvalPaddingBottomPx(rpt, row)));
                bm = new Bitmap(width, height);
                cri.DrawImage(bm);

                MemoryStream ostrm = new MemoryStream();
                // 06122007AJM Changed to use high quality JPEG encoding
                //bm.Save(ostrm, IMAGEFORMAT);	// generate a jpeg   TODO: get png to work with pdf
                System.Drawing.Imaging.ImageCodecInfo[] info;
                info = ImageCodecInfo.GetImageEncoders();
                EncoderParameters encoderParameters;
                encoderParameters = new EncoderParameters(1);
                // 20022008 AJM GJL - Using centralised image quality
                encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, ImageQualityManager.CustomImageQuality);
                System.Drawing.Imaging.ImageCodecInfo codec = null;
                for (int i = 0; i < info.Length; i++)
                {
                    if (info[i].FormatDescription == "JPEG")
                    {
                        codec = info[i];
                        break;
                    }
                }
                bm.Save(ostrm, codec, encoderParameters);

                byte[] ba = ostrm.ToArray();
                ostrm.Close();
                PageImage pi = new PageImage(IMAGEFORMAT, ba, width, height);	// Create an image
                pi.Sizing = ImageSizingEnum.Clip;
//                RunPageRegionBegin(pgs);

                SetPagePositionAndStyle(rpt, pi, row);

                if (pgs.CurrentPage.YOffset + pi.Y + pi.H >= pgs.BottomOfPage && !pgs.CurrentPage.IsEmpty())
                {	// force page break if it doesn't fit on the page
                    pgs.NextOrNew();
                    pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
                    if (this.YParents != null)
                        pi.Y = 0;
                }

                p = pgs.CurrentPage;

                p.AddObject(pi);	// Put image onto the current page

  //              RunPageRegionEnd(pgs);

                if (!this.PageBreakAtEnd && !IsTableOrMatrixCell(rpt))
                {
                    float newY = pi.Y + pi.H;
                    p.YOffset += newY;	// bump the y location
                }
                SetPagePositionEnd(pgs, pi.Y + pi.H);
            }
            catch (Exception ex)
            {
                rpt.rl.LogError(8, string.Format("Exception in CustomReportItem handling: {0}", ex.Message));
            }
            finally
            {
                if (cri != null)
                    cri.Dispose();
            }

            return;
        }
Exemplo n.º 9
0
		public Page RunPageNew(Pages pgs, Page p)
		{
			if (p.IsEmpty())			// if the page is empty it won't help to create another one
				return p;

			// Do we need a new page or have should we fill out more body columns
			Body b = OwnerReport.Body;
			int ccol = b.IncrCurrentColumn(pgs.Report);	// bump to next column

			float top = OwnerReport.TopOfPage;	// calc top of page

			if (ccol < b.Columns)
			{		// Stay on same page but move to new column
				p.XOffset = 
					((OwnerReport.Width.Points + b.ColumnSpacing.Points) * ccol);
				p.YOffset = top;
				p.SetEmpty();			// consider this page empty
			}
			else
			{		// Go to new page
				b.SetCurrentColumn(pgs.Report, 0);
				pgs.NextOrNew();
				p = pgs.CurrentPage;
				p.YOffset = top;
				p.XOffset = 0;
			}

			return p;
		}
Exemplo n.º 10
0
        override public void RunPage(Pages pgs, Row row)
        {
            Report rpt = pgs.Report;

            if (IsHidden(pgs.Report, row))
            {
                return;
            }

            _ChartMatrix.RunReset(rpt);
            Rows _Data = GetFilteredData(rpt, row);

            SetMyData(rpt, _Data);

            SetPagePositionBegin(pgs);

            if (!AnyRowsPage(pgs, _Data))                       // if no rows return
            {
                return;                                         //   nothing left to do
            }
            // Build the Chart bitmap, along with data regions
            Page      p  = pgs.CurrentPage;
            ChartBase cb = null;

            try
            {
                cb = RunChartBuild(rpt, row);                           // Build the chart
                if (!_isHYNEsWonderfulVector.EvaluateBoolean(rpt, row)) //AJM GJL 14082008 'Classic' Rendering
                {
                    System.Drawing.Image im = cb.Image(rpt);            // Grab the image
                    int height = im.Height;                             // save height and width
                    int width  = im.Width;

                    MemoryStream ostrm = new MemoryStream();

                    /* The following is a new image saving logic which will allow for higher
                     * quality images using JPEG with 100% quality
                     * 06122007AJM */
                    System.Drawing.Imaging.ImageCodecInfo[] info;
                    info = ImageCodecInfo.GetImageEncoders();
                    EncoderParameters encoderParameters;
                    encoderParameters = new EncoderParameters(1);
                    // 20022008 AJM GJL - Centralised class with global encoder settings
                    encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, ImageQualityManager.ChartImageQuality);
                    System.Drawing.Imaging.ImageCodecInfo codec = null;
                    for (int i = 0; i < info.Length; i++)
                    {
                        if (info[i].FormatDescription == "JPEG")
                        {
                            codec = info[i];
                            break;
                        }
                    }
                    im.Save(ostrm, codec, encoderParameters);
                    // 06122007AJM The follow has been replaced with the code above
                    //im.Save(ostrm, info);	// generate a jpeg   TODO: get png to work with pdf

                    byte[] ba = ostrm.ToArray();
                    ostrm.Close();
                    PageImage pi = new PageImage(IMAGEFORMAT, ba, width, height);       // Create an image

                    RunPageRegionBegin(pgs);

                    SetPagePositionAndStyle(rpt, pi, row);
                    pi.SI.BackgroundImage = null;       // chart already has the background image

                    if (pgs.CurrentPage.YOffset + pi.Y + pi.H >= pgs.BottomOfPage && !pgs.CurrentPage.IsEmpty())
                    {   // force page break if it doesn't fit on the page
                        pgs.NextOrNew();
                        pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
                        if (this.YParents != null)
                        {
                            pi.Y = 0;
                        }
                    }

                    p = pgs.CurrentPage;

                    p.AddObject(pi);    // Put image onto the current page

                    RunPageRegionEnd(pgs);

                    if (!this.PageBreakAtEnd && !IsTableOrMatrixCell(rpt))
                    {
                        float newY = pi.Y + pi.H;
                        p.YOffset += newY;      // bump the y location
                    }
                    SetPagePositionEnd(pgs, pi.Y + pi.H);
                }
                else //Ultimate Rendering - Vector //AJM GJL 14082008
                {
                    System.Drawing.Imaging.Metafile im = cb.Image(rpt); // Grab the image
                    //im could still be saved to a bitmap at this point
                    //if we were to offer a choice of raster or vector, it would probably
                    //be easiest to draw the chart to the EMF and then save as bitmap if needed
                    int    height = im.Height;                                                  // save height and width
                    int    width  = im.Width;
                    byte[] ba     = cb._aStream.ToArray();
                    cb._aStream.Close();

                    PageImage pi = new PageImage(ImageFormat.Wmf, ba, width, height);
                    RunPageRegionBegin(pgs);

                    SetPagePositionAndStyle(rpt, pi, row);
                    pi.SI.BackgroundImage = null;       // chart already has the background image

                    if (pgs.CurrentPage.YOffset + pi.Y + pi.H >= pgs.BottomOfPage && !pgs.CurrentPage.IsEmpty())
                    {   // force page break if it doesn't fit on the page
                        pgs.NextOrNew();
                        pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
                        if (this.YParents != null)
                        {
                            pi.Y = 0;
                        }
                    }

                    p = pgs.CurrentPage;

                    //GJL 25072008 - Charts now draw in EMFplus format and not in bitmap. Still using the "PageImage" for the positioning
                    //paging etc, but we don't add it to the page.
                    // ******************************************************************************************************************
                    // New EMF Processing... we want to add the EMF Components to the page and not the actual EMF...
                    EMF emf = new EMF(pi.X, pi.Y, width, height);
                    emf.ProcessEMF(ba); //Process takes the bytearray of EMFplus data and breaks it down into lines,ellipses,text,rectangles
                    //etc... There are still a lot of GDI+ functions I haven't got to (and some I have no intention of getting to!).
                    foreach (PageItem emfItem in emf.PageItems)
                    {
                        p.AddObject(emfItem);
                    }
                    // ******************************************************************************************************************

                    //p.AddObject(pi);
                    RunPageRegionEnd(pgs);
                    pi.Y += p.YOffset;
                    if (!this.PageBreakAtEnd && !IsTableOrMatrixCell(rpt))
                    {
                        float newY = pi.Y + pi.H;
                        p.YOffset += newY;                // bump the y location
                    }
                    SetPagePositionEnd(pgs, pi.Y + pi.H); //our emf size seems to be bigger than the jpeg...
                }
            }
            catch (Exception ex)
            {
                rpt.rl.LogError(8, string.Format("Exception in Chart handling.\n{0}\n{1}", ex.Message, ex.StackTrace));
            }
            finally
            {
                if (cb != null)
                {
                    cb.Dispose();
                }
            }

            return;
        }
Exemplo n.º 11
0
		public void RunPageRegionEnd(Pages pgs)
		{
			if (this.TC == null && this.PageBreakAtEnd && !pgs.CurrentPage.IsEmpty())
			{	// force page break at beginning of dataregion
				pgs.NextOrNew();
				pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
			}
		}
Exemplo n.º 12
0
		override public void RunPage(Pages pgs, Row row)
		{
			Report r = pgs.Report;
			TextboxRuntime tbr = TextboxRuntime.GetTextboxRuntime(r, this);

			tbr.RunCount++;		// Increment the run count

            bool bHidden = IsHidden(r, row);

			SetPagePositionBegin(pgs);

			string t;
            if (bHidden)
                t = "";
            else
                t = RunText(r, row);	// get the text

			bool bDup =	RunTextIsDuplicate(tbr, t, pgs.CurrentPage);
			if (bDup)
			{
				if (!(this.IsTableOrMatrixCell(r)))	// don't put out anything if not in Table or Matrix
					bHidden = true;
				t = "";		// still need to put out the cell
			}
			PageText pt;
			PageTextHtml pth=null;
			if (IsHtml(r, row))
				pt = pth = new PageTextHtml(t);
			else
				pt = new PageText(t);
			SetPagePositionAndStyle(r, pt, row);
			if (this.CanGrow && tbr.RunHeight == 0)	// when textbox is in a DataRegion this will already be called
			{
				this.RunTextCalcHeight(r, pgs.G, row, pt is PageTextHtml? pt as PageTextHtml: null);
			}
			pt.H = Math.Max(pt.H, tbr.RunHeight);		// reset height
			if (pt.SI.BackgroundImage != null)
				pt.SI.BackgroundImage.H = pt.H;		//   and in the background image
			pt.CanGrow = this.CanGrow;

            // check TextAlign: if General then correct based on data type
            if (pt.SI.TextAlign == TextAlignEnum.General)
            {
                if (DataType.IsNumeric(this.Value.GetTypeCode() ))
                    pt.SI.TextAlign = TextAlignEnum.Right;
            }

            // Hidden objects don't affect the current page?
            if (!bHidden)
            {
                // Force page break if it doesn't fit on a page
                if (this.IsInBody &&                         // Only force page when object directly in body
                    pgs.CurrentPage.YOffset + pt.Y + pt.H >= pgs.BottomOfPage && // running off end of page
                    !pgs.CurrentPage.IsEmpty())                             // if page is already empty don't force new
                {	// force page break if it doesn't fit on the page
                    pgs.NextOrNew();
                    pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
                    if (this.YParents != null)
                        pt.Y = 0;
                }

                Page p = pgs.CurrentPage;
                RecordPageReference(r, p, row);			// save information for late page header/footer references
                p.AddObject(pt);
                if (!bDup)
                {
                    tbr.PreviousText = t;	// previous text displayed
                    tbr.PreviousPage = p;	//  page previous text was shown on
                }
            }

			SetPagePositionEnd(pgs, pt.Y+pt.H);
			if (pth != null)
				pth.Reset();
			if (this.CanGrow && !Value.IsConstant())
			{
				tbr.RunHeight = 0;					// need to recalculate
			}
		}