private string BuildTable()
        {
            StringBuilder sb = new StringBuilder();
            float width = TableWidth();
            sb.AppendFormat("<table style=\"table-layout:fixed;width:{0}pt;border-style:none;border-collapse:collapse;\">", width);

            // Define the columns
            sb.Append("<colgroup>");
            List<ReportItem> riSort = new List<ReportItem>(_ris.Items);
            riSort.Sort(CompareRIsByX);

          //  float last_offset=0;
            float offset;
            float pt;
            for (int i = 0; i < riSort.Count; i++)
            {
                pt = riSort[i].LeftCalc(_rpt);

                sb.AppendFormat("<col style=\"width:{0}pts;\">", pt);

                offset = pt + riSort[i].WidthOrOwnerWidth(_rpt);

             //   if (last_offset < offset)
            }
            sb.Append("</colgroup>");

            // Define the rows
            riSort.Sort(CompareRIsByY);

            sb.Append("</table>");
            return sb.ToString();
        }
Ejemplo n.º 2
0
		private string AddParametersAsLiterals(Report rpt, IDbConnection cn, string sql, bool bValue)
		{
			// No parameters means nothing to do
			if (this._QueryParameters == null ||
				this._QueryParameters.Items == null ||
				this._QueryParameters.Items.Count == 0)
				return sql;

			// Only do this for ODBC datasources - AddParameters handles it in other cases
            if (!RdlEngineConfig.DoParameterReplacement(Provider, cn))
            {
                if (!_QueryParameters.ContainsArray)    // when array we do substitution
                    return sql;
            }

			StringBuilder sb = new StringBuilder(sql);
            List<QueryParameter> qlist;
			if (_QueryParameters.Items.Count <= 1)
				qlist = _QueryParameters.Items;
			else
			{	// need to sort the list so that longer items are first in the list
				// otherwise substitution could be done incorrectly
                qlist = new List<QueryParameter>(_QueryParameters.Items);
				qlist.Sort();
			}

			foreach(QueryParameter qp in qlist)
			{
				string paramName;

				// force the name to start with @
				if (qp.Name.Nm[0] == '@')
					paramName = qp.Name.Nm;
				else
					paramName = "@" + qp.Name.Nm;

				// build the replacement value
				string svalue;
				if (bValue)
				{	// use the value provided
                    svalue = this.ParameterValue(rpt, qp);
				}
				else
				{	// just need a place holder value that will pass parsing
					switch (qp.Value.Expr.GetTypeCode())
					{
						case TypeCode.Char:
							svalue = "' '";
							break;
						case TypeCode.DateTime:
							svalue = "'1900-01-01 00:00:00'";
							break;
						case TypeCode.Decimal:
						case TypeCode.Double:
						case TypeCode.Int32:
						case TypeCode.Int64:
							svalue = "0";
							break;
						case TypeCode.Boolean:
							svalue = "'false'";
							break;
						case TypeCode.String:
						default:
							svalue = "' '";
							break;
					}
				}
				sb.Replace(paramName, svalue);
			}
			return sb.ToString();
		}
		void InitFunctions(TreeNode ndRoot)
		{
            List<string> ar = new List<string>();
			
			ar.AddRange(StaticLists.FunctionList);

			// Build list of methods in the  VBFunctions class
			Oranikle.Report.Engine.FontStyleEnum fsi = FontStyleEnum.Italic;	// just want a class from RdlEngine.dll assembly
			Assembly a = Assembly.GetAssembly(fsi.GetType());
			if (a == null)
				return;
			Type ft = a.GetType("Oranikle.Report.Engine.VBFunctions");	 
			BuildMethods(ar, ft, "");

			// build list of financial methods in Financial class
			ft = a.GetType("Oranikle.Report.Engine.Financial");
			BuildMethods(ar, ft, "Financial.");

			a = Assembly.GetAssembly("".GetType());
			ft = a.GetType("System.Math");
			BuildMethods(ar, ft, "Math.");

			ft = a.GetType("System.Convert");
			BuildMethods(ar, ft, "Convert.");

			ft = a.GetType("System.String");
			BuildMethods(ar, ft, "String.");

			ar.Sort();
			string previous="";
			foreach (string item in ar)
			{
				if (item != previous)	// don't add duplicates
				{
					// Add the node to the tree
					TreeNode aRoot = new TreeNode(item);
					ndRoot.Nodes.Add(aRoot);
				}
				previous = item;
			}

		}