/// <summary>
        /// Returns the cell to add to a row for the given value, depending on the type of column it will be
        /// shown in.
        /// If the column is a TextColumn then just the Text property is set. For all other
        /// column types just the Data value is set.
        /// </summary>
        /// <param name="column"></param>
        /// <param name="val"></param>
        /// <returns></returns>
        public virtual Cell GetCell(Column column, object val)
        {
            Cell cell = null;

            switch (column.GetType().Name)
            {
            case "TextColumn":
                cell = new Cell(val.ToString());
                break;

            case "CheckBoxColumn":
                bool check = false;
                if (val is Boolean)
                {
                    check = (bool)val;
                }
                cell = new Cell("", check);
                break;

            default:
                cell = new Cell(val);
                break;
            }

            return(cell);
        }
예제 #2
0
        /// <summary>
        /// Returns the cell to add to a row for the given value, depending on the type of column it will be
        /// shown in.
        /// If the column is a TextColumn then just the Text property is set. For all other
        /// column types just the Data value is set.
        /// </summary>
        /// <param name="column"></param>
        /// <param name="val"></param>
        /// <returns></returns>
        public virtual Cell GetCell(Column column, object val)
        {
            Cell cell;

            switch (column.GetType().Name)
            {
            case nameof(TextColumn):
                cell = val == null ? new Cell() : new Cell(val.ToString());
                break;

            case nameof(CheckBoxColumn):
                bool check = val is bool && (bool)val;
                cell = new Cell("", check);
                break;

            default:
                cell = new Cell(val);
                break;
            }

            return(cell);
        }
예제 #3
0
        /// <summary>
        /// Returns the cell to add to a row for the given value, depending on the type of column it will be 
        /// shown in.
        /// If the column is a TextColumn then just the Text property is set. For all other
        /// column types just the Data value is set.
        /// </summary>
        /// <param name="column"></param>
        /// <param name="val"></param>
        /// <returns></returns>
        public virtual Cell GetCell(Column column, object val)
        {
            Cell cell = null;

            switch (column.GetType().Name)
            {
                case "TextColumn":
                    cell = new Cell(val.ToString());
                    break;

                case "CheckBoxColumn":
                    bool check = false;
                    if (val is Boolean)
                        check = (bool)val;
                    cell = new Cell("", check);
                    break;

                default:
                    cell = new Cell(val);
                    break;
            }

            return cell;
        }