Esempio n. 1
0
        /// <inheritdoc/>
        public override void GetData()
        {
            base.GetData();
            if (!String.IsNullOrEmpty(DataColumn))
            {
                object value = Report.GetColumnValue(DataColumn);
                Text = value == null ? "" : value.ToString();
            }
            else if (!String.IsNullOrEmpty(Expression))
            {
                object value = Report.Calc(Expression);
                Text = value == null ? "" : value.ToString();
            }
            else
            {
                // process expressions
                if (AllowExpressions && !String.IsNullOrEmpty(this.brackets))
                {
                    string[]     bracket_arr = this.brackets.Split(new char[] { ',' });
                    FindTextArgs args        = new FindTextArgs();
                    args.Text         = new FastString(Text);
                    args.OpenBracket  = bracket_arr[0];
                    args.CloseBracket = bracket_arr[1];
                    int expressionIndex = 0;
                    while (args.StartIndex < args.Text.Length)
                    {
                        string expression = CodeUtils.GetExpression(args, false);
                        if (expression == "")
                        {
                            break;
                        }

                        string value = Report.Calc(expression).ToString();
                        args.Text        = args.Text.Remove(args.StartIndex, args.EndIndex - args.StartIndex);
                        args.Text        = args.Text.Insert(args.StartIndex, value);
                        args.StartIndex += value.Length;
                        expressionIndex++;
                    }
                    Text = args.Text.ToString();
                }
            }

            if (Visible)
            {
                Visible = !String.IsNullOrEmpty(Text) || !HideIfNoData;
            }
            if (Visible)
            {
                try
                {
                    origRect = this.Bounds;
                    UpdateAutoSize();
                }
                catch
                {
                }
            }
        }
Esempio n. 2
0
        private bool InsideBrackets(int pos)
        {
            string[]     brackets = FRich.Brackets.Split(new char[] { ',' });
            FindTextArgs args     = new FindTextArgs();

            args.Text         = rtbText.Rtf;
            args.OpenBracket  = brackets[0];
            args.CloseBracket = brackets[1];
            args.StartIndex   = pos;
            return(CodeUtils.IndexInsideBrackets(args));
        }
Esempio n. 3
0
        /// <inheritdoc/>
        public override void GetData()
        {
            base.GetData();
            if (!String.IsNullOrEmpty(DataColumn))
            {
                object value = Report.GetColumnValue(DataColumn);
                if (value is byte[])
                {
                    using (MemoryStream stream = new MemoryStream((byte[])value))
                    {
                        FRichTextBox.LoadFile(stream, RichTextBoxStreamType.RichText);
                    }
                }
                else
                {
                    Text = value == null ? "" : value.ToString();
                }
            }
            else if (AllowExpressions)
            {
                // process expressions
                if (!String.IsNullOrEmpty(Brackets))
                {
                    string[]     brackets = Brackets.Split(new char[] { ',' });
                    FindTextArgs args     = new FindTextArgs();
                    args.Text         = FRichTextBox.Text;
                    args.OpenBracket  = brackets[0];
                    args.CloseBracket = brackets[1];
                    args.StartIndex   = ActualTextStart;
                    int expressionIndex = 0;

                    while (args.StartIndex < args.Text.Length)
                    {
                        string expression = CodeUtils.GetExpression(args, false);
                        if (expression == "")
                        {
                            break;
                        }

                        string formattedValue = CalcAndFormatExpression(expression, expressionIndex);
                        // strip off the "\r" characters since rich uses only "\n" for new line
                        formattedValue = formattedValue.Replace("\r", "");

                        args.Text = args.Text.Remove(args.StartIndex, args.EndIndex - args.StartIndex);
                        args.Text = args.Text.Insert(args.StartIndex, formattedValue);
                        FRichTextBox.SelectionStart  = args.StartIndex;
                        FRichTextBox.SelectionLength = args.EndIndex - args.StartIndex;
                        FRichTextBox.SelectedText    = formattedValue;
                        args.StartIndex += formattedValue.Length;
                        expressionIndex++;
                    }
                }
            }
        }
Esempio n. 4
0
        /// <inheritdoc/>
        public override void GetData()
        {
            base.GetData();

            // process expressions
            if (AllowExpressions)
            {
                if (!String.IsNullOrEmpty(Brackets))
                {
                    string[]     brackets = Brackets.Split(new char[] { ',' });
                    FindTextArgs args     = new FindTextArgs();
                    args.Text         = Text;
                    args.OpenBracket  = brackets[0];
                    args.CloseBracket = brackets[1];
                    int expressionIndex = 0;

                    while (args.StartIndex < args.Text.Length)
                    {
                        string expression = CodeUtils.GetExpression(args, false);
                        if (expression == "")
                        {
                            break;
                        }

                        string formattedValue = CalcAndFormatExpression(expression, expressionIndex);
                        args.Text        = args.Text.Remove(args.StartIndex, args.EndIndex - args.StartIndex);
                        args.Text        = args.Text.Insert(args.StartIndex, formattedValue);
                        args.StartIndex += formattedValue.Length;
                        expressionIndex++;
                    }
                    Text = args.Text;
                }
            }

            // process highlight
            Variant varValue = new Variant(Value);

            foreach (HighlightCondition condition in Highlight)
            {
                if ((bool)Report.Calc(condition.Expression, varValue) == true)
                {
                    ApplyCondition(condition);
                    break;
                }
            }

            // process AutoShrink
            ProcessAutoShrink();
        }
Esempio n. 5
0
        /// <inheritdoc/>
        public override void GetData()
        {
            base.GetData();

            // process expressions
            if (AllowExpressions)
            {
                if (!String.IsNullOrEmpty(Brackets))
                {
                    string[]     brackets = Brackets.Split(new char[] { ',' });
                    FindTextArgs args     = new FindTextArgs();
                    args.Text         = new FastString(Text);
                    args.OpenBracket  = brackets[0];
                    args.CloseBracket = brackets[1];
                    int expressionIndex = 0;

                    while (args.StartIndex < args.Text.Length)
                    {
                        string expression = CodeUtils.GetExpression(args, false);
                        if (expression == "")
                        {
                            break;
                        }

                        string formattedValue = CalcAndFormatExpression(expression, expressionIndex);
                        args.Text        = args.Text.Remove(args.StartIndex, args.EndIndex - args.StartIndex);
                        args.Text        = args.Text.Insert(args.StartIndex, formattedValue);
                        args.StartIndex += formattedValue.Length;
                        expressionIndex++;
                    }
                    Text = args.Text.ToString();
                }
            }

            // process highlight
            Variant varValue = new Variant(Value);
        }