Ejemplo n.º 1
0
 //Присвоение значения
 public void Apply(IReportShape rshape, int value)
 {
     try
     {
         var code = Token.Text;
         if (!rshape.Vars.ContainsKey(code))
         {
             rshape.Vars.Add(code, new ShapeVar(code));
         }
         rshape.Vars[code].Value = _expr.GetMean(rshape, value);
     }
     catch { }
 }
Ejemplo n.º 2
0
        //Установка свойства фигуры
        public void Apply(IReportShape rshape, int value) //Значение привязанного параметра
        {
            try
            {
                var shape = rshape.Shape.GroupItems.Item(_shapeCode);
                if (Token.Text == null || shape == null)
                {
                    return;
                }
                var mean = _expr.GetMean(rshape, value);
                switch (Token.Text.ToLower())
                {
                case "visible":
                    shape.Visible = mean.Bool ? MsoTriState.msoTrue : MsoTriState.msoFalse;
                    break;

                case "text":
                    shape.TextFrame.Characters().Text = mean.String;
                    break;

                case "decimalplaces":
                    shape.TextFrame.Characters().Text = Math.Round(shape.TextFrame.Characters().Text.ToDouble(), mean.Integer).ToString();
                    break;

                case "color":
                    shape.Fill.ForeColor.RGB = mean.Integer;
                    break;

                case "backcolor":
                    shape.Fill.BackColor.RGB = mean.Integer;
                    break;

                case "linecolor":
                    shape.Line.ForeColor.RGB = mean.Integer;
                    break;

                case "fontcolor":
                    shape.DrawingObject.Font.Color = mean.Integer;
                    break;

                case "pattern":
                    switch (mean.Integer)
                    {
                    case 0: shape.Fill.Solid(); break;

                    case 1: shape.Fill.Patterned(MsoPatternType.msoPatternDarkHorizontal); break;

                    case 2: shape.Fill.Patterned(MsoPatternType.msoPatternDarkVertical); break;
                    }
                    break;

                case "transparent":
                    shape.Fill.Transparency = (float)mean.Real;
                    break;

                case "linetransparent":
                    shape.Line.Transparency = (float)mean.Real;
                    break;
                }
            }
            catch { }
        }