Пример #1
0
        public bool Merge(WorkbookColumn column)
        {
            if (Title == column.Title)
            {
                // To this.Cells add all the cells from the second column without header
                var cells = column.Cells.GetRange(1, column.Cells.Count - 1);
                Cells.AddRange(cells);
                return(true);
            }

            return(false);
        }
Пример #2
0
        public bool Merge(WorkbookSheet other)
        {
            if (!WorkbookHeader.Merge(other.WorkbookHeader))
            {
                return(false);
            }

            WorkbookColumn[] backupColumns = new WorkbookColumn[Columns.Count];
            Columns.CopyTo(backupColumns);
            for (int i = 0; i < Columns.Count; i++)
            {
                var column = Columns[i];
                if (!column.Merge(other.Columns[i]))
                {
                    Columns = backupColumns.ToList();
                    return(false);
                }

                Columns[i] = column;
            }

            Rows.AddRange(other.Rows);
            return(true);
        }