IStreamGen _sg; // stream generater #endregion Fields #region Constructors public RenderExcel(Report rep, IStreamGen sg) { r = rep; _sg = sg; // We need this in future _Excel = new ExcelValet(); }
public object Evaluate(Report rpt, Row row) { object v = null; if (row == null) return null; bool bSave=true; RowEnumerable re = this.GetDataScope(rpt, row, out bSave); if (re == null) return null; Row crow=null; bool bNext=false; foreach (Row r in re) { if (bNext) { crow = r; break; } if (r == row) bNext = true; } if (crow != null) v = _Expr.Evaluate(rpt, crow); return v; }
public object Evaluate(Report rpt, Row row) { bool bSave=true; IEnumerable re = this.GetDataScope(rpt, row, out bSave); if (re == null) return null; object v = GetValue(rpt); if (v == null) { object max_value=null; object current_value; foreach (Row r in re) { current_value = _Expr.Evaluate(rpt, r); if (current_value == null) continue; else if (max_value == null) max_value = current_value; else if (Filter.ApplyCompare(_tc, max_value, current_value) < 0) max_value = current_value; } v = max_value; if (bSave) SetValue(rpt, v); } return v; }
// public virtual object Evaluate(Report rpt, Row row) { if (row == null) return null; Field f; string field = _ArgExpr.EvaluateString(rpt, row); if (field == null) return null; f = _Fields[field] as Field; if (f == null) return null; object o; if (f.Value != null) o = f.Value.Evaluate(rpt, row); else o = row.Data[f.ColumnNumber]; if (o == DBNull.Value) return null; if (f.RunType == TypeCode.String && o is char) // work around; mono odbc driver confuses string and char o = Convert.ChangeType(o, TypeCode.String); return o; }
// Evaluate is for interpretation (and is relatively slow) public object Evaluate(Report rpt, Row row) { double d = EvaluateDouble(rpt, row); if (d.CompareTo(double.NaN) == 0) return null; return (object) d; }
public object Evaluate(Report rpt, Row row) { bool bSave=true; IEnumerable re = this.GetDataScope(rpt, row, out bSave); if (re == null) return null; Row startrow=null; foreach (Row r in re) { startrow = r; // We just want the first row break; } object current_value = _Expr.Evaluate(rpt, row); if (row == startrow) {} else { object v = GetValue(rpt); if (current_value == null) return v; else if (v == null) {} // use the current_value else if (Filter.ApplyCompare(_tc, v, current_value) < 0) {} // use the current_value else return v; } SetValue(rpt, current_value); return current_value; }
TextWriter tw; // where the output is going #endregion Fields #region Constructors public RenderXml(Report rep, IStreamGen sg) { r = rep; tw = sg.GetTextWriter(); stkReportItem = new Stack(); stkContainers = new Stack(); }
internal DynamicExpression(Report rpt, ReportLink p, string expr, Row row) { _Source=expr; _Expr = null; _rl = p; _Type = DoParse(rpt); }
public ProcessReport(Report rep, IStreamGen sg) { if (rep.rl.MaxSeverity > 4) throw new Exception("Report has errors. Cannot be processed."); r = rep; _sg = sg; }
public ProcessReport(Report rep) { if (rep.rl.MaxSeverity > 4) throw new Exception("Report has errors. Cannot be processed."); r = rep; _sg = null; }
string[] _values; // values for each report item #endregion Fields #region Constructors // spot for each _ris; public TablePositioner(Report rpt, ReportItems ris) { _rpt = rpt; _ris = ris; _values = new string[ris.Items.Count]; _TableSyntax = BuildTable(); }
public decimal EvaluateDecimal(Report rpt, Row row) { double d = EvaluateDouble(rpt, row); if (d.CompareTo(double.NaN) == 0) return decimal.MinValue; return Convert.ToDecimal(d); }
public bool EvaluateBoolean(Report rpt, Row row) { object left = _lhs.Evaluate(rpt, row); object right = _rhs.Evaluate(rpt, row); if (Filter.ApplyCompare(_lhs.GetTypeCode(), left, right) > 0) return true; else return false; }
public RenderRtf(Report rep, IStreamGen sg) { r = rep; _sg = sg; // We need this in future tw = new StringWriter(); // will hold the bulk of the RTF until we generate _Fonts = new System.Collections.Generic.List<string>(); _Colors = new System.Collections.Generic.List<Color>(); }
// public object Evaluate(Report rpt, Row row) { double di = _expr[0].EvaluateDouble(rpt, row); int i = (int) di; // force it to integer; we'll accept truncation if (i >= _expr.Length || i <= 0) return null; return _expr[i].Evaluate(rpt, row); }
internal override void Draw(Report rpt) { CreateSizedBitmap(); using (Graphics g1 = Graphics.FromImage(_bm)) { _aStream = new System.IO.MemoryStream(); IntPtr HDC = g1.GetHdc(); _mf = new System.Drawing.Imaging.Metafile(_aStream, HDC, new RectangleF(0, 0, _bm.Width, _bm.Height), System.Drawing.Imaging.MetafileFrameUnit.Pixel); g1.ReleaseHdc(HDC); } using (Graphics g = Graphics.FromImage(_mf)) { // 06122007AJM Used to Force Higher Quality g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None; g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; // Adjust the top margin to depend on the title height Size titleSize = DrawTitleMeasure(rpt, g, ChartDefn.Title); Layout.TopMargin = titleSize.Height; DrawChartStyle(rpt, g); // Draw title; routine determines if necessary DrawTitle(rpt, g, ChartDefn.Title, new System.Drawing.Rectangle(0, 0, _bm.Width, Layout.TopMargin)); // Draw legend System.Drawing.Rectangle lRect = DrawLegend(rpt, g, false, true); // Adjust the bottom margin to depend on the Category Axis Size caSize = CategoryAxisSize(rpt, g); Layout.BottomMargin = caSize.Height; // 20022008 AJM GJL - Added required info AdjustMargins(lRect,rpt,g); // Adjust margins based on legend. // Draw Plot area DrawPlotAreaStyle(rpt, g, lRect); // Draw Category Axis if (caSize.Height > 0) DrawCategoryAxis(rpt, g, new System.Drawing.Rectangle(Layout.LeftMargin, _bm.Height-Layout.BottomMargin, _bm.Width - Layout.LeftMargin - Layout.RightMargin, caSize.Height)); if (ChartDefn.Type == ChartTypeEnum.Doughnut) DrawPlotAreaDoughnut(rpt, g); else DrawPlotAreaPie(rpt, g); DrawLegend(rpt, g, false, false); } }
public int EvaluateInt32(Report rpt, Row row) { bool bSave=true; RowEnumerable re = this.GetDataScope(rpt, row, out bSave); if (re == null) return 0; int count = re.LastRow - re.FirstRow + 1; return count; }
// public virtual object Evaluate(Report rpt, Row row) { string o = _ArgExpr.EvaluateString(rpt, row); if (o == null) return null; ReportParameter rp = _Parameters[o] as ReportParameter; if (rp == null) return null; return rp.GetRuntimeValue(rpt); }
Report _rpt; // Runtime report #endregion Fields #region Constructors internal DataSources(Report rpt, DataSourcesDefn dsds) { _rpt = rpt; _Items = new ListDictionary(); // Loop thru all the child nodes foreach(DataSourceDefn dsd in dsds.Items.Values) { DataSource ds = new DataSource(rpt, dsd); _Items.Add(dsd.Name.Nm, ds); } }
internal override void Draw(Report rpt) { CreateSizedBitmap(); using (Graphics g1 = Graphics.FromImage(_bm)) { _aStream = new System.IO.MemoryStream(); IntPtr HDC = g1.GetHdc(); //_mf = new System.Drawing.Imaging.Metafile(_aStream, HDC); _mf = new System.Drawing.Imaging.Metafile(_aStream, HDC, new RectangleF(0, 0, _bm.Width, _bm.Height),System.Drawing.Imaging.MetafileFrameUnit.Pixel); g1.ReleaseHdc(HDC); } using(Graphics g = Graphics.FromImage(_mf)) { // 06122007AJM Used to Force Higher Quality g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None; g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; // Adjust the top margin to depend on the title height Size titleSize = DrawTitleMeasure(rpt, g, ChartDefn.Title); Layout.TopMargin = titleSize.Height; double max=0,min=0; // Get the max and min values // GetValueMaxMin(rpt, ref max, ref min,0, 1); DrawChartStyle(rpt, g); // Draw title; routine determines if necessary DrawTitle(rpt, g, ChartDefn.Title, new System.Drawing.Rectangle(0, 0, _bm.Width, Layout.TopMargin)); Layout.LeftMargin = 0; Layout.RightMargin = 0; // Draw legend System.Drawing.Rectangle lRect = DrawLegend(rpt, g, false, true); Layout.BottomMargin = 0; AdjustMargins(lRect,rpt, g); // Adjust margins based on legend. // Draw Plot area DrawPlotAreaStyle(rpt, g, lRect); string subtype = _ChartDefn.Subtype.EvaluateString(rpt, _row); DrawMap(rpt, g, subtype, max, min); DrawLegend(rpt, g, false, false); } }
// Evaluate is for interpretation (and is relatively slow) public object Evaluate(Report rpt, Row row) { bool result = _If.EvaluateBoolean(rpt, row); if (result) return _IfTrue.Evaluate(rpt, row); object o = _IfFalse.Evaluate(rpt, row); // We may need to convert IfFalse to same type as IfTrue if (_IfTrue.GetTypeCode() == _IfFalse.GetTypeCode()) return o; return Convert.ChangeType(o, _IfTrue.GetTypeCode()); }
public double EvaluateDouble(Report rpt, Row row) { if (row == null || this._Scope == null) return 0; Grouping g = this._Scope as Grouping; if (g == null || g.ParentGroup == null) return 0; // GroupEntry ge = row.R.CurrentGroups[g.Index]; // current group entry return row.Level; }
// public virtual object Evaluate(Report rpt, Row row) { if (row == null) return null; Textbox tb; string t = _ArgExpr.EvaluateString(rpt, row); if (t == null) return null; tb = _ReportItems[t] as Textbox; if (tb == null) return null; return tb.Evaluate(rpt, row); }
internal ChartBase(Report r, Row row, Chart c, MatrixCellEntry[,] m, Expression showTooltips, Expression showTooltipsX, Expression _ToolTipYFormat, Expression _ToolTipXFormat) { _ChartDefn = c; _row = row; _DataDefn = m; _bm = null; int width = _ChartDefn.WidthCalc(r, null); int height = RSize.PixelsFromPoints(_ChartDefn.HeightOrOwnerHeight); Layout = new ChartLayout(width, height); _SeriesBrush = null; _SeriesMarker = null; _showToolTips = showTooltips.EvaluateBoolean(r, row); _showToolTipsX = showTooltipsX.EvaluateBoolean(r, row); _tooltipYFormat = _ToolTipYFormat.EvaluateString(r, row); _tooltipXFormat = _ToolTipXFormat.EvaluateString(r, row); }
Report _rpt; // runtime report #endregion Fields #region Constructors internal DataSets(Report rpt, DataSetsDefn dsn) { _rpt = rpt; if (dsn.Items.Count < 10) _Items = new ListDictionary(); // Hashtable is overkill for small lists else _Items = new Hashtable(dsn.Items.Count); // Loop thru all the child nodes foreach(DataSetDefn dsd in dsn.Items.Values) { DataSet ds = new DataSet(rpt, dsd); _Items.Add(dsd.Name.Nm, ds); } }
// Evaluate is for interpretation (and is relatively slow) public override object Evaluate(Report rpt, Row row) { string v = base.EvaluateString(rpt, row); if (p.ValidValues == null) return v; string[] displayValues = p.ValidValues.DisplayValues(rpt); object[] dataValues = p.ValidValues.DataValues(rpt); for (int i=0; i < dataValues.Length; i++) { if (dataValues[i].ToString() == v) return displayValues[i]; } return v; }
// Evaluate is for interpretation (and is relatively slow) public object Evaluate(Report rpt, Row row) { bool result; for (int i=0; i < _expr.Length; i = i+2) { result = _expr[i].EvaluateBoolean(rpt, row); if (result) { object o = _expr[i+1].Evaluate(rpt, row); // We may need to convert to same type as first type if (i == 0 || _tc == _expr[i+1].GetTypeCode()) // first typecode will always match return o; return Convert.ChangeType(o, _tc); } } return null; }
// public virtual object Evaluate(Report rpt, Row row) { if (rpt == null) return null; string u = _ArgExpr.EvaluateString(rpt, row); if (u == null) return null; switch (u.ToLower()) { case "userid": return rpt.UserID; case "language": return rpt.ClientLanguage == null? CultureInfo.CurrentCulture.ThreeLetterISOLanguageName: rpt.ClientLanguage; default: return null; } }
public object Evaluate(Report rpt, Row row) { bool bSave=true; RowEnumerable re = this.GetDataScope(rpt, row, out bSave); if (re == null) return null; object v = GetValue(rpt); if (v == null) { Row saver=null; if (re.Data.Count > 0) saver = re.Data[re.FirstRow] as Row; v = _Expr.Evaluate(rpt, saver); if (bSave) SetValue(rpt, v); } return v; }
// Evaluate is for interpretation (and is relatively slow) public object Evaluate(Report rpt, Row row) { bool bSave = true; RowEnumerable re = this.GetDataScope(rpt, row, out bSave); if (re == null) return null; object v = GetValue(rpt); if (v == null) { object temp; ArrayList ar = new ArrayList(Math.Max(1,re.LastRow - re.FirstRow + 1)); foreach (Row r in re) { temp = _Expr.Evaluate(rpt, r); ar.Add(temp); } v = ar; if (bSave) SetValue(rpt, v); } return v; }
public DateTime EvaluateDateTime(Report rpt, Row row) { object result = Evaluate(rpt, row); return(Convert.ToDateTime(result)); }
internal bool ConnectDataSource(Report rpt) { IDbConnection cn = GetConnection(rpt); if (cn != null) { return(true); } if (_DataSourceReference != null) { ConnectDataSourceReference(rpt); // this will create a _ConnectionProperties } if (_ConnectionProperties == null || _ConnectionProperties.ConnectstringValue == null) { return(false); } bool rc = false; try { cn = EngineConfig.GetConnection(_ConnectionProperties.DataProvider, _ConnectionProperties.Connectstring(rpt)); if (cn != null) { cn.Open(); rc = true; } } catch (Exception e) { string err = string.Format("DataSource '{0}'.\r\n{1}", _Name, e.InnerException == null? e.Message: e.InnerException.Message); if (rpt == null) { OwnerReport.rl.LogError(4, err); // error occurred during parse phase } else { rpt.rl.LogError(4, err); } if (cn != null) { cn.Close(); cn = null; } } if (cn != null) { SetSysConnection(rpt, cn); } else { string err = string.Format("Unable to connect to datasource '{0}'.", this._Name.Nm); if (rpt == null) { OwnerReport.rl.LogError(4, err); // error occurred during parse phase } else { rpt.rl.LogError(4, err); } } return(rc); }
private ODouble GetValue(Report rpt) { return(rpt.Cache.Get(_key) as ODouble); }
private void SetValue(Report rpt, double d) { rpt.Cache.AddReplace(_key, new ODouble(d)); }
public DateTime EvaluateDateTime(Report rpt, Row row) { return(DateTime.MinValue); }
internal IDbConnection SqlConnect(Report rpt) { return(GetConnection(rpt)); }
public double EvaluateDouble(Report rpt, Row row) { return(double.NaN); }
public void ClearCache(Report rpt) { rpt.Cache.Remove(_key); }
public int EvaluateInt32(Report rpt, Row row) { return(int.MinValue); }
public string EvaluateString(Report rpt, Row row) { bool result = EvaluateBoolean(rpt, row); return(result.ToString()); }
internal bool IsConnected(Report rpt) { return(GetConnection(rpt) == null? false: true); }
// Runtime data; either original query if no groups // or sorting or a copied version that is grouped/sorted private Rows GetMyData(Report rpt) { return(rpt.Cache.Get(this, "data") as Rows); }
override internal 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; }
internal UserReportParameter(Report rpt, ReportParameter rp) { _rpt = rpt; _rp = rp; }
public decimal EvaluateDecimal(Report rpt, Row row) { return(decimal.MinValue); }
// Evaluate is for interpretation (and is relatively slow) public object Evaluate(Report rpt, Row row) { return(EvaluateBoolean(rpt, row)); }