Beispiel #1
0
 public override void RenderCell(Cells.Data.Cell p_cell, RptCellArgs p_args)
 {
     if (p_args.Col == 1)
     {
         string name = View.Info.Params.Str("parentname");
         if (name == "根菜单")
         {
             p_cell.Value      = name;
             p_cell.Foreground = Res.BlackBrush;
         }
         else
         {
             p_cell.Value = "<- " + name;
         }
     }
     else if (p_args.Col == 2)
     {
         if (p_args.Data.Bool("isgroup"))
         {
             p_cell.Value      = "V";
             p_cell.Foreground = Res.GreenBrush;
         }
         else
         {
             p_cell.Value      = "X";
             p_cell.Foreground = Res.RedBrush;
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// 给 cell 实例对象设定RptText的样式
        /// </summary>
        /// <param name="p_cell"></param>
        public void ApplyStyle(Cells.Data.Cell p_cell)
        {
            p_cell.WordWrap            = WordWrap;
            p_cell.FontFamily          = new FontFamily(FontFamily);
            p_cell.FontSize            = FontSize;
            p_cell.FontWeight          = Bold ? FontWeights.Bold : FontWeights.Normal;
            p_cell.FontStyle           = Italic ? FontStyle.Italic : FontStyle.Normal;
            p_cell.Underline           = UnderLine;
            p_cell.Strikethrough       = StrikeOut;
            p_cell.Foreground          = HandleClick ? Dt.Base.Res.主题蓝色 : new SolidColorBrush(Foreground);
            p_cell.Background          = Background.A == 0 ? null : new SolidColorBrush(Background);
            p_cell.HorizontalAlignment = Horalign;
            p_cell.VerticalAlignment   = Veralign;
            p_cell.TextIndent          = Margin;

            if (p_cell.RowSpan > 1 || p_cell.ColumnSpan > 1)
            {
                Worksheet sheet = p_cell.Worksheet;
                for (int i = p_cell.Column.Index; i < p_cell.Column.Index + p_cell.ColumnSpan; i++)
                {
                    sheet[p_cell.Row.Index, i].BorderTop = TopStyle == BorderLineStyle.None ? null : new BorderLine(TopColor, TopStyle);
                    sheet[p_cell.Row.Index + p_cell.RowSpan - 1, i].BorderBottom = BottomStyle == BorderLineStyle.None ? null : new BorderLine(BottomColor, BottomStyle);
                }
                for (int i = p_cell.Row.Index; i < p_cell.Row.Index + p_cell.RowSpan; i++)
                {
                    sheet[i, p_cell.Column.Index].BorderLeft = LeftStyle == BorderLineStyle.None ? null : new BorderLine(LeftColor, LeftStyle);
                    sheet[i, p_cell.Column.Index + p_cell.ColumnSpan - 1].BorderRight = RightStyle == BorderLineStyle.None ? null : new BorderLine(RightColor, RightStyle);
                }
            }
            else
            {
                p_cell.BorderLeft   = LeftStyle == BorderLineStyle.None ? null : new BorderLine(LeftColor, LeftStyle);
                p_cell.BorderTop    = TopStyle == BorderLineStyle.None ? null : new BorderLine(TopColor, TopStyle);
                p_cell.BorderRight  = RightStyle == BorderLineStyle.None ? null : new BorderLine(RightColor, RightStyle);
                p_cell.BorderBottom = BottomStyle == BorderLineStyle.None ? null : new BorderLine(BottomColor, BottomStyle);
            }
        }
Beispiel #3
0
 /// <summary>
 /// 绘制单元格内容和样式
 /// </summary>
 /// <param name="p_cell">单元格</param>
 /// <param name="p_args">单元格脚本参数</param>
 public virtual void RenderCell(Cells.Data.Cell p_cell, RptCellArgs p_args)
 {
 }