public void RunPage(Pages pgs, Row row) { // Start each row in the same location // e.g. if there are two embedded tables in cells they both start at same location Page savepg = pgs.CurrentPage; float savey = savepg.YOffset; Page maxpg = savepg; float maxy = savey; foreach (TableCell tc in _Items) { tc.RunPage(pgs, row); if (maxpg != pgs.CurrentPage) { // a page break if (maxpg.PageNumber < pgs.CurrentPage.PageNumber) { maxpg = pgs.CurrentPage; maxy = maxpg.YOffset; } } else if (maxy > pgs.CurrentPage.YOffset) { // maxy = maxy; TODO what was this meant to do } // restore the beginning start of the row pgs.CurrentPage = savepg; savepg.YOffset = savey; } pgs.CurrentPage = maxpg; savepg.YOffset = maxy; return ; }
override public void RunPage(Pages pgs, Row row) { Report r = pgs.Report; bool bHidden = IsHidden(r, row); SetPagePositionBegin(pgs); PageLine pl = new PageLine(); SetPagePositionAndStyle(r, pl, row); if (!bHidden) pgs.CurrentPage.AddObject(pl); SetPagePositionEnd(pgs, pl.Y); }
public void RunPage(Pages pgs, Row row) { Page p = pgs.CurrentPage; if (p.YOffset + HeightOfRows(pgs, row) > pgs.BottomOfPage) { p = OwnerTable.RunPageNew(pgs, p); OwnerTable.RunPageHeader(pgs, row, false, null); } _TableRows.RunPage(pgs, row); return; }
public void RunPages(Pages pgs) // this does all the work { int pageNo = 1; // STEP: processing a page. foreach (Page p in pgs) { System.Drawing.Bitmap bm = CreateObjectBitmap(); System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bm); g.PageUnit = GraphicsUnit.Pixel; g.ScaleTransform(1, 1); DpiX = g.DpiX; DpiY = g.DpiY; // STEP: Fill backgroup g.FillRectangle(Brushes.White, 0F, 0F, (float)bm.Width, (float)bm.Height); // STEP: draw page to bitmap ProcessPage(g, p); // STEP: System.Drawing.Bitmap bm2 = ConvertToBitonal(bm); if (pageNo == 1) _tif = bm2; SaveBitmap(_tif, bm2, tw, pageNo); pageNo++; } if (_tif != null) { // STEP: prepare encoder parameters EncoderParameters encoderParams = new EncoderParameters(1); encoderParams.Param[0] = new EncoderParameter( System.Drawing.Imaging.Encoder.SaveFlag, (long)EncoderValue.Flush ); // STEP: _tif.SaveAdd(encoderParams); } return; }
public PageDrawing(Pages pgs) { // Set up the tooltip _tt = new ToolTip(); _tt.Active = false; _tt.ShowAlways = true; _HitList = new List<HitListEntry>(); _SelectList = new List<PageItem>(); _LastZoom = 1; _pgs = pgs; // Get our graphics DPI Graphics ga = null; try { ga = this.CreateGraphics(); DpiX = ga.DpiX; DpiY = ga.DpiY; } catch { DpiX = DpiY = 96; } finally { if (ga != null) ga.Dispose(); } // force to double buffering for smoother drawing //this.SetStyle(ControlStyles.DoubleBuffer | // ControlStyles.UserPaint | // ControlStyles.AllPaintingInWmPaint, // true); this.DoubleBuffered = true; }
public void RunPage(Pages pgs, Row row) { WorkClass wc = this.GetValue(pgs.Report); if (wc.OutputRow == row && wc.OutputPage == pgs.CurrentPage) return; Page p = pgs.CurrentPage; float height = p.YOffset + HeightOfRows(pgs, row); if (height > pgs.BottomOfPage) { Table t = OwnerTable; p = t.RunPageNew(pgs, p); t.RunPageHeader(pgs, row, false, null); if (this.RepeatOnNewPage) return; // should already be on the page } _TableRows.RunPage(pgs, row); wc.OutputRow = row; wc.OutputPage = pgs.CurrentPage; return; }
public void RunPage(Pages pgs, Rows rs, int start, int end, float footerHeight) { // if no rows output or rows just leave if (rs == null || rs.Data == null) return; if (this.Visibility != null && Visibility.IsHidden(pgs.Report, rs.Data[start])) return; // not visible Page p; Row row; for (int r=start; r <= end; r++) { p = pgs.CurrentPage; // this can change after running a row row = rs.Data[r]; float hrows = HeightOfRows(pgs, row); // height of all the rows in the details float height = p.YOffset + hrows; if (r == end) height += footerHeight; // on last row; may need additional room for footer if (height > pgs.BottomOfPage) { p = OwnerTable.RunPageNew(pgs, p); OwnerTable.RunPageHeader(pgs, row, false, null); _TableRows.RunPage(pgs, row, true); // force checking since header + hrows might be > BottomOfPage } else _TableRows.RunPage(pgs, row, hrows > pgs.BottomOfPage); } return; }
public float HeightOfRows(Pages pgs, Row r) { if (this.Visibility != null && Visibility.IsHidden(pgs.Report, r)) { return 0; } return _TableRows.HeightOfRows(pgs, r); }
public void RunPages(Pages pgs) { }
public void RunPage(Pages pgs, Row row) { RunPage(pgs, row, false); }
public void RunPage(Pages pgs, Row row) { if (this.Visibility != null && Visibility.IsHidden(pgs.Report, row)) return; _TableCells.RunPage(pgs, row); WorkClass wc = GetWC(pgs.Report); pgs.CurrentPage.YOffset += wc.CalcHeight; return ; }
public void RunPage(Pages pgs, Row row) { // todo: visibility on the column should really only be evaluated once at the beginning // of the table processing; also this doesn't account for the affect of colspan correctly // where if any of the spanned columns are visible the value would show?? TableColumn tc = _OwnerTable.TableColumns[_ColIndex]; if (tc.Visibility != null && tc.Visibility.IsHidden(pgs.Report, row)) // column visible? return; // no nothing to do _ReportItems.Items[0].RunPage(pgs, row); return; }
override public void RunPage(Pages pgs, Row row) { Report r = pgs.Report; if (IsHidden(r, row)) return; WorkClass wc = GetValue(r); wc.FullData = wc.Data = GetFilteredData(r, row); SetPagePositionBegin(pgs); if (!AnyRowsPage(pgs, wc.Data)) // if no rows return return; // nothing left to do int maxColumns; int maxRows; int headerRows = _ColumnGroupings.Items.Count; // number of column headers we have MatrixCellEntry[,] matrix = RunBuild(r, out maxRows, out maxColumns); // Now run thru the rows and columns of the matrix creating the pages RunPageRegionBegin(pgs); Page p = pgs.CurrentPage; p.YOffset += this.RelativeY(r); for (int iRow = 0; iRow < maxRows; iRow++) { float h = HeightOfRow(pgs, matrix, iRow); if (h <= 0) // there were no cells in row continue; // skip the row if (p.YOffset + h > pgs.BottomOfPage) { p = RunPageNew(pgs, p); // run thru the headers again for (int aRow = 0; aRow < headerRows; aRow++) { RunPageColumns(pgs, wc, matrix, aRow, maxColumns); p.YOffset += HeightOfRow(pgs, matrix, aRow); } } RunPageColumns(pgs, wc, matrix, iRow, maxColumns); p.YOffset += h; } RunPageRegionEnd(pgs); SetPagePositionEnd(pgs, pgs.CurrentPage.YOffset); RemoveValue(r); }
/// <summary> /// Forces the report to get rebuilt especially after changing parameters or data. /// </summary> public void Rebuild() { // Aulofee customization - start. Code added (2 lines) to avoid to execute twice GetPages and so the SQL query (custo end). if (_pgs == null) { LoadPageIfNeeded(); if (_Report == null) throw new Exception("Report must be loaded prior to Rebuild being called."); // Aulofee customization - start. Code added (2 lines) to avoid to execute twice GetPages and so the SQL query (custo end). } else _pgs = GetPages(this._Report); _DrawPanel.Pgs = _pgs; _vScroll.Value = 0; CalcZoom(); _DrawPanel.Invalidate(); }
/// <summary> /// Build the Pages for this report. /// </summary> /// <returns></returns> public Pages BuildPages() { PageNumber = 1; // reset page numbers TotalPages = 1; Pages pgs = new Pages(this); pgs.PageHeight = _Report.PageHeight.Points; pgs.PageWidth = _Report.PageWidth.Points; try { Page p = new Page(1); // kick it off with a new page pgs.AddPage(p); // Create all the pages _Report.Body.RunPage(pgs); if (pgs.LastPage.IsEmpty() && pgs.PageCount > 1) // get rid of extraneous pages which pgs.RemoveLastPage(); // can be caused by region page break at end // Now create the headers and footers for all the pages (as needed) if (_Report.PageHeader != null) _Report.PageHeader.RunPage(pgs); if (_Report.PageFooter != null) _Report.PageFooter.RunPage(pgs); // clear out any runtime clutter foreach (Page pg in pgs) pg.ResetPageExpressions(); pgs.SortPageItems(); // Handle ZIndex ordering of pages } catch (Exception e) { rl.LogError(8, "Exception running report\r\n" + e.Message + "\r\n" + e.StackTrace); } finally { pgs.CleanUp(); // always want to make sure we clean this up since _Cache = new RCache(); } return pgs; }
public void RunPage(IPresent ip) { Pages pgs = new Pages(ip.Report()); try { Page p = new Page(1); // kick it off with a new page pgs.AddPage(p); // Create all the pages _Body.RunPage(pgs); if (pgs.LastPage.IsEmpty()&& pgs.PageCount > 1) // get rid of extraneous pages which pgs.RemoveLastPage(); // can be caused by region page break at end // Now create the headers and footers for all the pages (as needed) if (_PageHeader != null) _PageHeader.RunPage(pgs); if (_PageFooter != null) _PageFooter.RunPage(pgs); pgs.SortPageItems(); // Handle ZIndex ordering of pages ip.RunPages(pgs); } finally { pgs.CleanUp(); // always want to make sure we clean this up since if (_DataSourcesDefn != null) _DataSourcesDefn.CleanUp(pgs.Report); // ensure datasets are cleaned up } return; }
/// <summary> /// RunRenderTif will render a TIF given the page structure /// </summary> /// <param name="sg"></param> /// <param name="pgs"></param> public void RunRenderTif(IStreamGen sg, Pages pgs, bool bColor) { PageNumber = 1; // reset page numbers TotalPages = 1; RenderTif ip = new RenderTif(this, sg); ip.RenderColor = bColor; try { ip.Start(); ip.RunPages(pgs); ip.End(); } finally { pgs.CleanUp(); // always want to make sure we cleanup to reduce resource usage _Cache = new RCache(); } return; }
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; }
public virtual void RunPage(Pages pgs, Row row) { return; }
/// <summary> /// Call LoadPageIfNeeded when a routine requires the report to be loaded in order /// to fulfill the request. /// </summary> private void LoadPageIfNeeded() { if (_pgs == null) { Cursor savec=null; System.Threading.Thread t=null; try { // 15052008 AJM - Updating Render notification window - This could be improved to show current action in the future if (_ShowWaitDialog) { t = new System.Threading.Thread(new System.Threading.ThreadStart(showWait)); t.Start(); } _InLoading = true; savec = this.Cursor; // this could take a while so put up wait cursor this.Cursor = Cursors.WaitCursor; _pgs = GetPages(); _DrawPanel.Pgs = _pgs; CalcZoom(); // this could affect zoom } finally { _InLoading = false; if (savec != null) this.Cursor = savec; if (t != null) { int i = 0; while ((t.ThreadState & System.Threading.ThreadState.AbortRequested) != System.Threading.ThreadState.AbortRequested && (t.ThreadState & System.Threading.ThreadState.Aborted) != System.Threading.ThreadState.Aborted && (t.ThreadState & System.Threading.ThreadState.Stopped) != System.Threading.ThreadState.Stopped && (t.ThreadState & System.Threading.ThreadState.StopRequested) != System.Threading.ThreadState.StopRequested) { try { t.Abort(); } catch //(Exception e) PJR don't declare variable as we aren't using it anyway. { } i++; } } } RdlViewer_Layout(this, null); // re layout based on new report } }
public float HeightOfRows(Pages pgs, Row r) { return(_TableRows.HeightOfRows(pgs, r)); }
private void ParametersViewClick(object sender, System.EventArgs e) { Cursor.Current = Cursors.WaitCursor; System.Threading.Thread t = null; try { _RunButton.Enabled = false; _errorMsgs = null; // reset the error message if (this._Report == null) return; // Force parameters to get built foreach (Control ctl in _ParameterPanel.Controls) { if (ctl.Tag is UserReportParameter) { if (ctl is TextBox) this.ParametersTextValidated(ctl, new EventArgs()); else if (ctl is ComboBox) this.ParametersLeave(ctl, new EventArgs()); } } bool bFail = false; foreach (UserReportParameter rp in _Report.UserReportParameters) { if (rp.Prompt == null) continue; if (rp.Value == null && !rp.Nullable) { MessageBox.Show(string.Format("Parameter '{0}' is required but not provided.", rp.Prompt), "Report Parameter Missing"); bFail = true; } } if (bFail) return; if (_ShowWaitDialog) { t = new System.Threading.Thread(new System.Threading.ThreadStart(showWait)); t.Start(); } _pgs = GetPages(this._Report); _DrawPanel.Pgs = _pgs; _vScroll.Value = 0; CalcZoom(); _WarningButton.Visible = WarningVisible(); _DrawPanel.Invalidate(); } catch { // don't fail out; occasionally get thread abort exception } finally { _RunButton.Enabled = true; Cursor.Current = Cursors.Default; if (t != null) { int i = 0; while (t.ThreadState != System.Threading.ThreadState.AbortRequested && t.ThreadState != System.Threading.ThreadState.Aborted && t.ThreadState != System.Threading.ThreadState.Stopped && t.ThreadState != System.Threading.ThreadState.StopRequested) { t.Abort(); i++; } } } }
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); }
private bool _ShowWaitDialog = true; // show wait dialog when running report public RdlViewer() { _SourceFileName=null; _SourceRdl=null; _Parameters=null; // parameters to run the report _pgs=null; // the pages of the report to view _loadFailed=false; _PageWidth=0; _PageHeight=0; _ReportDescription=null; _ReportAuthor=null; _ReportName=null; _zoom=-1; // force zoom to be calculated // Get our graphics DPI Graphics g = null; try { g = this.CreateGraphics(); DpiX = g.DpiX; DpiY = g.DpiY; } catch { DpiX = DpiY = 96; } finally { if (g != null) g.Dispose(); } _ScrollMode = ScrollModeEnum.Continuous; // Handle the controls _vScroll = new VScrollBar(); _vScroll.Scroll += new ScrollEventHandler(this.VerticalScroll); _vScroll.Enabled = false; // tooltip _vScrollToolTip = new ToolTip(); _vScrollToolTip.AutomaticDelay = 100; // .1 seconds _vScrollToolTip.AutoPopDelay = 1000; // 1 second _vScrollToolTip.ReshowDelay = 100; // .1 seconds _vScrollToolTip.InitialDelay = 10; // .01 seconds _vScrollToolTip.ShowAlways = false; _vScrollToolTip.SetToolTip(_vScroll, ""); _hScroll = new HScrollBar(); _hScroll.Scroll += new ScrollEventHandler(this.HorizontalScroll); _hScroll.Enabled = false; _DrawPanel = new PageDrawing(null); _DrawPanel.Parent = this; _DrawPanel.Paint += new PaintEventHandler(this.DrawPanelPaint); _DrawPanel.Resize += new EventHandler(this.DrawPanelResize); _DrawPanel.MouseWheel +=new MouseEventHandler(DrawPanelMouseWheel); _DrawPanel.KeyDown += new KeyEventHandler(DrawPanelKeyDown); _RunButton = new Button(); _RunButton.Parent = this; _RunButton.Text = "Run Report"; _RunButton.Width = 90; _RunButton.FlatStyle = FlatStyle.Flat; _RunButton.Click += new System.EventHandler(ParametersViewClick); _WarningButton = new PictureBox(); _WarningButton.Parent = this; _WarningButton.Width = 15; _WarningButton.Height = 15; _WarningButton.Paint +=new PaintEventHandler(_WarningButton_Paint); _WarningButton.Click += new System.EventHandler(WarningClick); ToolTip tip = new ToolTip(); tip.AutomaticDelay = 500; tip.ShowAlways = true; tip.SetToolTip(_WarningButton, "Click to see Report Warnings"); _ParameterPanel = new ScrollableControl(); _FindCtl = new RdlViewerFind(); _FindCtl.Height = 27; _FindCtl.Parent = this; _FindCtl.Viewer = this; _FindCtl.Visible = false; this.Layout +=new LayoutEventHandler(RdlViewer_Layout); this.SuspendLayout(); // Must be added in this order for DockStyle to work correctly this.Controls.Add(_FindCtl); this.Controls.Add(_DrawPanel); this.Controls.Add(_vScroll); this.Controls.Add(_hScroll); this.Controls.Add(_ParameterPanel); this.ResumeLayout(false); }
public float HeightOfRows(Pages pgs, Row r) { return _TableRows.HeightOfRows(pgs, r); }
public float HeightOfRow(Pages pgs, Row r) { return HeightOfRow(pgs.Report, pgs.G, r); }
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; }
float HeightOfRow(Pages pgs, MatrixCellEntry[,] matrix, int iRow) { Report rpt = pgs.Report; WorkClass wc = GetValue(rpt); int maxColumns = matrix.GetLength(1); float height=0; bool bResetAllHeights=false; // Handle the corner; it might span rows & columns bool bCorner = false; float cornerHeight=0; if (iRow == 0 && matrix[0, 0] != null && (this.ColumnGroupings.Items.Count > 1 || this.RowGroupings.Items.Count > 1)) { bCorner = true; } for (int iCol=0; iCol < maxColumns; iCol++) { MatrixCellEntry mce = matrix[iRow, iCol]; if (mce == null) continue; if (mce.DisplayItem is Textbox) { Textbox tb = mce.DisplayItem as Textbox; if (tb.CanGrow) { wc.Data = mce.Data; // Must set this for evaluation Row lrow = wc.Data.Data.Count > 0? wc.Data.Data[0]:null; mce.DisplayItem.SetMC(rpt, mce); // set for use by the display item SetGroupingValues(rpt, mce); float tbh = tb.RunTextCalcHeight(rpt, pgs.G, lrow); if (height < tbh) { if (bCorner && iCol == 0) { cornerHeight = tbh; } else { bResetAllHeights = true; height = tbh; } } } } if (bCorner && iCol == 0) continue; if (height < mce.Height) height = mce.Height; } if (bResetAllHeights) // If any text forces the row to grow; all heights must be fixed { for (int iCol=0; iCol < maxColumns; iCol++) { if (bCorner && iCol == 0) continue; MatrixCellEntry mce = matrix[iRow, iCol]; if (mce != null) mce.Height = height; } } // Even with expansion room; we might need more space for the corner if (bCorner && cornerHeight > matrix[0,0].Height) { // add the additional space needed to the first row's height float newRow0Height; if (ColumnGroupings.Items.Count == 1) newRow0Height = cornerHeight; else if (matrix[0,1] != null) newRow0Height = matrix[0,1].Height + (cornerHeight - matrix[0,0].Height); else newRow0Height = (cornerHeight - matrix[0,0].Height); height = newRow0Height; matrix[0,0].Height = cornerHeight; for (int iCol=1; iCol < maxColumns; iCol++) { MatrixCellEntry mce = matrix[0, iCol]; if (mce != null) mce.Height = newRow0Height; } } return height; }
public void RunPages(Pages pgs) // we don't have paging turned on for html { }
void RunPageColumns(Pages pgs, WorkClass wc, MatrixCellEntry[,] matrix, int iRow, int maxColumns) { Report rpt = pgs.Report; float xpos = GetOffsetCalc(pgs.Report) + LeftCalc(rpt); for (int iColumn = 0; iColumn < maxColumns; iColumn++) { MatrixCellEntry mce = matrix[iRow, iColumn]; if (mce == null) { // have a null column but we need to fill column space xpos += WidthOfColumn(matrix, iColumn); continue; } wc.Data = mce.Data; // Must set this for evaluation Row lrow = wc.Data.Data.Count > 0? wc.Data.Data[0]:null; SetGroupingValues(rpt, mce); mce.DisplayItem.SetMC(rpt, mce); // set for use by the display item mce.XPosition = xpos; mce.DisplayItem.RunPage(pgs, lrow); xpos += mce.Width; iColumn += (mce.ColSpan-1); // skip columns already accounted for } }
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 r = pgs.Report; if (IsHidden(r, row)) return; WorkClass wc = GetValue(r); wc.Data = GetFilteredData(r, row); SetPagePositionBegin(pgs); if (!AnyRowsPage(pgs, wc.Data)) // if no rows return return; // nothing left to do RunPageRegionBegin(pgs); RunSetGrouping(pgs.Report, wc); RunPageGroups(pgs, wc, wc.Groups); RunPageRegionEnd(pgs); SetPagePositionEnd(pgs, pgs.CurrentPage.YOffset); RemoveValue(r); }
private void RunPageGroups(Pages pgs, WorkClass wc, List<GroupEntry> groupEntries) { Report rpt = pgs.Report; Page p = pgs.CurrentPage; float pagebottom = OwnerReport.BottomOfPage; // p.YOffset += (Top == null? 0: this.Top.Points); p.YOffset += this.RelativeY(rpt); float listoffset = GetOffsetCalc(pgs.Report) + LeftCalc(pgs.Report); float height; Row row; foreach (GroupEntry ge in groupEntries) { // set the group entry value int index; if (ge.Group != null) // groups? { ge.Group.ResetHideDuplicates(rpt); // reset duplicate checking index = ge.Group.GetIndex(rpt); // yes } else // no; must be main dataset index = 0; wc.Data.CurrentGroups[index] = ge; if (ge.NestedGroup.Count > 0) RunGroupsSetGroups(rpt, wc, ge.NestedGroup); if (ge.Group == null) { // need to run all the rows since no group defined for (int r=ge.StartRow; r <= ge.EndRow; r++) { row = wc.Data.Data[r]; height = HeightOfList(rpt, pgs.G, row); if (p.YOffset + height > pagebottom && !p.IsEmpty()) // need another page for this row? p = RunPageNew(pgs, p); // yes; if at end this page is empty float saveYoffset = p.YOffset; // this can be affected by other page items if (_ReportItems != null) _ReportItems.RunPage(pgs, row, listoffset); if (p == pgs.CurrentPage) // did subitems force new page? { // no use the height of the list p.YOffset = saveYoffset + height; } else { // got forced to new page; just add the padding on p = pgs.CurrentPage; // set to new page if (this.Style != null) { p.YOffset += this.Style.EvalPaddingBottom(rpt, row); } } } } else { // need to process just whole group as a List entry if (ge.Group.PageBreakAtStart && !p.IsEmpty()) p = RunPageNew(pgs, p); // pass the first row of the group row = wc.Data.Data[ge.StartRow]; height = HeightOfList(rpt, pgs.G, row); if (p.YOffset + height > pagebottom && !p.IsEmpty()) // need another page for this row? p = RunPageNew(pgs, p); // yes; if at end this page is empty float saveYoffset = p.YOffset; // this can be affected by other page items if (_ReportItems != null) _ReportItems.RunPage(pgs, row, listoffset); if (p == pgs.CurrentPage) // did subitems force new page? { // no use the height of the list p.YOffset = saveYoffset + height; } else { // got forced to new page; just add the padding on p = pgs.CurrentPage; // set to new page if (this.Style != null) { p.YOffset += this.Style.EvalPaddingBottom(rpt, row); } } if (ge.Group.PageBreakAtEnd || // need another page for next group? p.YOffset + height > pagebottom) { p = RunPageNew(pgs, p); // yes; if at end empty page will be cleaned up later } } RemoveWC(rpt); } }
override public void RunPage(Pages pgs, Row row) { Report r = pgs.Report; if (IsHidden(r, row)) return; base.RunPage(pgs, row); // need to save the owner report and nest in this defintion ReportDefn saveReport = r.ReportDefinition; NeedPassword np = r.GetDataSourceReferencePassword; // get current password r.SetReportDefinition(_ReportDefn); r.Folder = _ReportDefn.ParseFolder; // folder needs to get set since the id of the report is used by the cache r.GetDataSourceReferencePassword = np; DataSourcesDefn saveDS = r.ParentConnections; if (this.MergeTransactions) r.ParentConnections = saveReport.DataSourcesDefn; else r.ParentConnections = null; r.SubreportDataRetrievalTriggerEvent(); bool bRows = true; if (_Parameters == null) { // When no parameters we only retrieve data once SubreportWorkClass wc = r.Cache.Get(this, "report") as SubreportWorkClass; if (wc == null) { // run report first time; bRows = r.RunGetData(null); if (!r.IsSubreportDataRetrievalDefined) // if use has defined subreportdataretrieval they might set data r.Cache.Add(this, "report", new SubreportWorkClass(bRows)); // so we can't cache } else bRows = wc.bRows; } else { SetSubreportParameters(r, row); // apply the parameters bRows = r.RunGetData(null); } SetPageLeft(r); // Set the Left attribute since this will be the margin for this report SetPagePositionBegin(pgs); float yOffset; if (bRows) // Only run subreport if have a row in some Dataset { // // Run the subreport -- this is the major effort in creating the display objects in the page // r.ReportDefinition.Body.RunPage(pgs); // create a the subreport items yOffset = pgs.CurrentPage.YOffset; } else { // Handle NoRows message string msg; if (this.NoRows != null) msg = this.NoRows.EvaluateString(pgs.Report, null); else msg = null; if (msg != null) { PageText pt = new PageText(msg); SetPagePositionAndStyle(pgs.Report, pt, null); if (pt.SI.BackgroundImage != null) pt.SI.BackgroundImage.H = pt.H; // and in the background image pgs.CurrentPage.AddObject(pt); yOffset = pt.Y + pt.H; } else yOffset = pgs.CurrentPage.YOffset; } r.SetReportDefinition(saveReport); // restore the current report r.ParentConnections = saveDS; // restore the data connnections SetPagePositionEnd(pgs, yOffset); }
override public void RunPage(Pages pgs, Row row) { Report r = pgs.Report; if (IsHidden(r, row)) { return; } base.RunPage(pgs, row); // need to save the owner report and nest in this defintion ReportDefn saveReport = r.ReportDefinition; NeedPassword np = r.GetDataSourceReferencePassword; // get current password r.SetReportDefinition(_ReportDefn); r.Folder = _ReportDefn.ParseFolder; // folder needs to get set since the id of the report is used by the cache r.GetDataSourceReferencePassword = np; DataSourcesDefn saveDS = r.ParentConnections; if (this.MergeTransactions) { r.ParentConnections = saveReport.DataSourcesDefn; } else { r.ParentConnections = null; } r.SubreportDataRetrievalTriggerEvent(); bool bRows = true; if (_Parameters == null) { // When no parameters we only retrieve data once SubreportWorkClass wc = r.Cache.Get(this, "report") as SubreportWorkClass; if (wc == null) { // run report first time; bRows = r.RunGetData(null); if (!r.IsSubreportDataRetrievalDefined) // if use has defined subreportdataretrieval they might set data { r.Cache.Add(this, "report", new SubreportWorkClass(bRows)); // so we can't cache } } else { bRows = wc.bRows; } } else { SetSubreportParameters(r, row); // apply the parameters bRows = r.RunGetData(null); } SetPageLeft(r); // Set the Left attribute since this will be the margin for this report SetPagePositionBegin(pgs); float yOffset; if (bRows) // Only run subreport if have a row in some Dataset { // // Run the subreport -- this is the major effort in creating the display objects in the page // r.ReportDefinition.Body.RunPage(pgs); // create a the subreport items yOffset = pgs.CurrentPage.YOffset; } else { // Handle NoRows message string msg; if (this.NoRows != null) { msg = this.NoRows.EvaluateString(pgs.Report, null); } else { msg = null; } if (msg != null) { PageText pt = new PageText(msg); SetPagePositionAndStyle(pgs.Report, pt, null); if (pt.SI.BackgroundImage != null) { pt.SI.BackgroundImage.H = pt.H; // and in the background image } pgs.CurrentPage.AddObject(pt); yOffset = pt.Y + pt.H; } else { yOffset = pgs.CurrentPage.YOffset; } } r.SetReportDefinition(saveReport); // restore the current report r.ParentConnections = saveDS; // restore the data connnections SetPagePositionEnd(pgs, yOffset); }