/// <summary>
        /// Initializes a new instance of the <see cref="Section"/> class.
        /// </summary>
        /// <param name="id">The section's unique identifier.</param>
        /// <param name="treeTable">The tree table.</param>
        /// <param name="name">OPTIONAL name of the section.  DEFAULT is a section with no name.</param>
        /// <param name="title">OPTIONAL title of the section.  DEFAULT is a section with no title.</param>
        /// <param name="format">OPTIONAL format to apply to the section.  DEFAULT is to leave the format unchanged.</param>
        public Section(
            string id,
            TreeTable treeTable,
            string name          = null,
            string title         = null,
            SectionFormat format = null)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            if (string.IsNullOrWhiteSpace(id))
            {
                throw new ArgumentException(Invariant($"{nameof(id)} is white space."));
            }

            if (treeTable == null)
            {
                throw new ArgumentNullException(nameof(treeTable));
            }

            this.Id        = id;
            this.TreeTable = treeTable;
            this.Name      = name;
            this.Title     = title;
            this.Format    = format;
        }
Exemplo n.º 2
0
        public Section DeepCloneWithTreeTable(TreeTable treeTable)
        {
            var result = new Section(
                this.Id?.DeepClone(),
                treeTable,
                this.Name?.DeepClone(),
                this.Title?.DeepClone(),
                this.Format?.DeepClone());

            return(result);
        }
        /// <summary>
        /// Gets all cells in a table.
        /// </summary>
        /// <param name="treeTable">The table.</param>
        /// <returns>
        /// All cells in a table.
        /// </returns>
        public static IReadOnlyCollection <ICell> GetAllCells(
            this TreeTable treeTable)
        {
            if (treeTable == null)
            {
                throw new ArgumentNullException(nameof(treeTable));
            }

            var result = treeTable.TableRows == null
                ? new List <ICell>()
                : treeTable.TableRows.GetAllCells();

            return(result);
        }
        /// <summary>
        /// Gets all of the rows, header and descendants included, in the order they appear in the table.
        /// </summary>
        /// <param name="treeTable">The table.</param>
        /// <returns>
        /// The rows, header and descendants included, in the order they appear in the table.
        /// </returns>
        public static IReadOnlyList <RowBase> GetAllRowsInOrder(
            this TreeTable treeTable)
        {
            if (treeTable == null)
            {
                throw new ArgumentNullException(nameof(treeTable));
            }

            var result = treeTable.TableRows == null
                ? new List <RowBase>()
                : treeTable.TableRows.GetAllRowsInOrder();

            return(result);
        }