Changeset 12707 for stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelRangeBase.cs
- Timestamp:
- 07/10/15 12:07:08 (9 years ago)
- Location:
- stable
- Files:
-
- 4 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 12074,12089-12090,12093,12095,12100-12101,12104,12178-12180
- Property svn:mergeinfo changed
-
stable/HeuristicLab.ExtLibs
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.ExtLibs merged: 12074,12100-12101,12104,12178-12180
- Property svn:mergeinfo changed
-
stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3
-
Property
svn:ignore
set to
obj
bin
-
Property
svn:ignore
set to
-
stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelRangeBase.cs
r12074 r12707 59 59 /// A range of cells 60 60 /// </summary> 61 public class ExcelRangeBase : ExcelAddress, IExcelCell, I Disposable, IEnumerable<ExcelRangeBase>, IEnumerator<ExcelRangeBase>61 public class ExcelRangeBase : ExcelAddress, IExcelCell, IEnumerable<ExcelRangeBase> 62 62 { 63 63 /// <summary> … … 2758 2758 public IEnumerator<ExcelRangeBase> GetEnumerator() 2759 2759 { 2760 Reset(); 2761 return this; 2760 return new ExcelRangeBaseEnumerator(this); 2762 2761 } 2763 2762 2764 2763 IEnumerator IEnumerable.GetEnumerator() 2765 2764 { 2766 Reset(); 2767 return this; 2765 return new ExcelRangeBaseEnumerator(this); 2768 2766 } 2769 2767 … … 2771 2769 /// The current range when enumerating 2772 2770 /// </summary> 2773 public ExcelRangeBase Current 2774 { 2775 get 2776 { 2777 return new ExcelRangeBase(_worksheet, ExcelAddressBase.GetAddress(cellEnum.Row, cellEnum.Column)); 2778 } 2779 } 2780 2781 /// <summary> 2782 /// The current range when enumerating 2783 /// </summary> 2784 object IEnumerator.Current 2785 { 2786 get 2787 { 2788 return ((object)(new ExcelRangeBase(_worksheet, ExcelAddressBase.GetAddress(cellEnum.Row, cellEnum.Column)))); 2789 } 2790 } 2791 2792 int _enumAddressIx = -1; 2793 public bool MoveNext() 2794 { 2795 if (cellEnum.Next()) 2796 { 2797 return true; 2771 public class ExcelRangeBaseEnumerator : IEnumerator<ExcelRangeBase> { 2772 private CellsStoreEnumerator<object> _cellEnum; 2773 private int _enumAddressIx = -1; 2774 private ExcelRangeBase _range; 2775 private ExcelRangeBase _current; 2776 2777 /// <summary> 2778 /// The current range when enumerating 2779 /// </summary> 2780 public ExcelRangeBase Current { 2781 get { 2782 return _current; 2783 } 2798 2784 } 2799 else if (_addresses!=null) 2800 { 2801 _enumAddressIx++; 2802 if (_enumAddressIx < _addresses.Count) 2803 { 2804 cellEnum = new CellsStoreEnumerator<object>(_worksheet._values, 2805 _addresses[_enumAddressIx]._fromRow, 2806 _addresses[_enumAddressIx]._fromCol, 2807 _addresses[_enumAddressIx]._toRow, 2808 _addresses[_enumAddressIx]._toCol); 2809 return MoveNext(); 2810 } 2811 else 2812 { 2813 return false; 2785 2786 /// <summary> 2787 /// The current range when enumerating 2788 /// </summary> 2789 object IEnumerator.Current { 2790 get { 2791 return _current; 2814 2792 } 2815 2793 } 2816 return false; 2817 } 2818 2819 public void Reset() 2820 { 2821 _enumAddressIx = -1; 2822 cellEnum = new CellsStoreEnumerator<object>(_worksheet._values, _fromRow, _fromCol, _toRow, _toCol); 2794 2795 public ExcelRangeBaseEnumerator(ExcelRangeBase range) { 2796 this._range = range; 2797 Reset(); 2798 } 2799 public bool MoveNext() { 2800 if (_cellEnum.Next()) { 2801 _current._fromCol = _cellEnum.Column; 2802 _current._fromRow = _cellEnum.Row; 2803 _current._toCol = _cellEnum.Column; 2804 _current._toRow = _cellEnum.Row; 2805 _current.Address = GetAddress(_current._fromRow, _current._fromCol); 2806 return true; 2807 } 2808 else if (_range._addresses != null) { 2809 _enumAddressIx++; 2810 if (_enumAddressIx < _range._addresses.Count) { 2811 _cellEnum = new CellsStoreEnumerator<object>(_range._worksheet._values, 2812 _range._addresses[_enumAddressIx]._fromRow, 2813 _range._addresses[_enumAddressIx]._fromCol, 2814 _range._addresses[_enumAddressIx]._toRow, 2815 _range._addresses[_enumAddressIx]._toCol); 2816 return MoveNext(); 2817 } 2818 else { 2819 return false; 2820 } 2821 } 2822 return false; 2823 } 2824 2825 public void Reset() { 2826 _enumAddressIx = -1; 2827 _cellEnum = new CellsStoreEnumerator<object>(_range._worksheet._values, _range._fromRow, _range._fromCol, _range._toRow, _range._toCol); 2828 _current = new ExcelRangeBase(_range._worksheet, ExcelAddressBase.GetAddress(_cellEnum.Row, _cellEnum.Column)); 2829 } 2830 2831 public void Dispose() { 2832 if (_cellEnum != null) { 2833 _cellEnum.Dispose(); 2834 _cellEnum = null; 2835 } 2836 } 2837 2823 2838 } 2824 2839
Note: See TracChangeset
for help on using the changeset viewer.