diff --git a/ClosedXML/Excel/PivotTables/XLPivotTables.cs b/ClosedXML/Excel/PivotTables/XLPivotTables.cs index e64d78e..6a71642 100644 --- a/ClosedXML/Excel/PivotTables/XLPivotTables.cs +++ b/ClosedXML/Excel/PivotTables/XLPivotTables.cs @@ -1,13 +1,35 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; namespace ClosedXML.Excel { - internal class XLPivotTables: IXLPivotTables + internal class XLPivotTables : IXLPivotTables { private readonly Dictionary _pivotTables = new Dictionary(); + + public void Add(String name, IXLPivotTable pivotTable) + { + _pivotTables.Add(name, (XLPivotTable)pivotTable); + } + + public IXLPivotTable AddNew(string name, IXLCell target, IXLRange source) + { + var pivotTable = new XLPivotTable { Name = name, TargetCell = target, SourceRange = source }; + _pivotTables.Add(name, pivotTable); + return pivotTable; + } + + public void Delete(String name) + { + _pivotTables.Remove(name); + } + + public void DeleteAll() + { + _pivotTables.Clear(); + } + public IEnumerator GetEnumerator() { return _pivotTables.Values.Cast().GetEnumerator(); @@ -22,30 +44,10 @@ { return _pivotTables[name]; } + IXLPivotTable IXLPivotTables.PivotTable(String name) { return PivotTable(name); } - public void Delete(String name) - { - _pivotTables.Remove(name); - } - public void DeleteAll() - { - _pivotTables.Clear(); - } - - public void Add(String name, IXLPivotTable pivotTable) - { - _pivotTables.Add(name, (XLPivotTable)pivotTable); - } - - public IXLPivotTable AddNew(string name, IXLCell target, IXLRange source) - { - var pivotTable = new XLPivotTable { Name = name, TargetCell = target, SourceRange = source }; - _pivotTables.Add(name, pivotTable); - return pivotTable; - } - } }