using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; namespace FlexFramework.Excel { /// /// Data table /// public abstract class Table : ReadOnlyCollection, ICloneable { public Table(IList list) : base(list) { } public IList Rows { get { return Items; } } public Cell this[string address] { get { if (!Address.IsValid(address)) throw new FormatException(); return this[new Address(address)]; } } public Cell this[Address address] { get { return this.SelectMany(row => row).First(cell => cell.Address == address); } } public IEnumerable this[Range range] { get { return this.SelectMany(row => row).Where(cell => range.Contains(cell.Address)); } } public abstract Table DeepClone(); public abstract Table ShallowClone(); } }