From 448af8ecd7bf9db070e090c4b434da693ba0ae89 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Sat, 1 Apr 2023 15:58:42 +0300 Subject: Move Excel extensions to own project --- RhSolutions.ExcelExtensions/Row.cs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 RhSolutions.ExcelExtensions/Row.cs (limited to 'RhSolutions.ExcelExtensions/Row.cs') diff --git a/RhSolutions.ExcelExtensions/Row.cs b/RhSolutions.ExcelExtensions/Row.cs new file mode 100644 index 0000000..32617b4 --- /dev/null +++ b/RhSolutions.ExcelExtensions/Row.cs @@ -0,0 +1,33 @@ +using System.Collections; + +namespace RhSolutions.ExcelExtensions; + +public sealed class Row : Table, IEnumerable +{ + public int Index + { + get => Range.Row - ParentTable.Range.Row; + } + public int Length + { + get => Range.Columns.Count; + } + + public Row(Range range, Table table) : base(range, table) + { + Range = range; + ParentTable = table; + } + + public TableCell this[int index] + { + get => new(Range.Cells[1, index + 1], ParentTable); + } + + public IEnumerator GetEnumerator() + { + return new RowEnumerator(Range, ParentTable); + } + + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); +} -- cgit v1.2.3