public Column DeepCloneWithFormat(ColumnFormat format)
        {
            var result = new Column(
                this.Id?.DeepClone(),
                format);

            return(result);
        }
        public TableColumns DeepCloneWithColumnsFormat(ColumnFormat columnsFormat)
        {
            var result = new TableColumns(
                this.Columns?.DeepClone(),
                columnsFormat);

            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Column"/> class.
        /// </summary>
        /// <param name="id">OPTIONAL id of the column.  DEFAULT is non-identified column.</param>
        /// <param name="format">
        /// OPTIONAL format to apply to the whole column.
        /// Some format-items, by their nature, apply to the whole column (e.g. <see cref="ColumnFormat.WidthInPixels"/>, <see cref="ColumnFormat.AutofitColumnWidth"/>).
        /// All others will be applied to just the <see cref="DataRows"/> within the column (e.g. <see cref="ColumnFormat.CellsFormat"/>
        /// will NOT be applied to <see cref="HeaderRows"/> nor <see cref="FooterRows"/>).
        /// DEFAULT is to leave the format unchanged.
        /// </param>
        public Column(
            string id           = null,
            ColumnFormat format = null)
        {
            if ((id != null) && string.IsNullOrWhiteSpace(id))
            {
                throw new ArgumentException(Invariant($"{nameof(id)} is white space"));
            }

            this.Id     = id;
            this.Format = format;
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TableColumns"/> class.
        /// </summary>
        /// <param name="columns">The columns.</param>
        /// <param name="columnsFormat">
        /// OPTIONAL format to apply to all columns in the table, individually.
        /// Some format-items, by their nature, apply to the whole column (e.g. <see cref="ColumnFormat.WidthInPixels"/>, <see cref="ColumnFormat.AutofitColumnWidth"/>).
        /// All others will be applied to just the <see cref="DataRows"/> within the column (e.g. <see cref="ColumnFormat.CellsFormat"/>
        /// will NOT be applied to <see cref="HeaderRows"/> nor <see cref="FooterRows"/>).
        /// DEFAULT is to leave the format unchanged.
        /// </param>
        public TableColumns(
            IReadOnlyList <Column> columns,
            ColumnFormat columnsFormat = null)
        {
            if (columns == null)
            {
                throw new ArgumentNullException(nameof(columns));
            }

            if (!columns.Any())
            {
                throw new ArgumentException(Invariant($"{nameof(columns)} is an empty enumerable."));
            }

            if (columns.Any(_ => _ == null))
            {
                throw new ArgumentException(Invariant($"{nameof(columns)} contains at least one null element."));
            }

            this.Columns       = columns;
            this.ColumnsFormat = columnsFormat;
        }