Esempio n. 1
0
        /// <summary>
        /// Add a worksheet to this workbook. Sheet names must be unique.
        /// </summary>
        /// <exception cref="ArgumentException">Thrown if a sheet with the same Name already exists</exception>
        /// <param name="sheet"></param>
        public void Add(Worksheet sheet)
        {
            // According to ECMA-376, sheet names must be unique
            if (_sheets.Any(s => s.Name == sheet.Name))
            {
                throw new ArgumentException("This workbook already contains a sheet named " + sheet.Name);
            }

            _sheets.Add(sheet);
        }