aboutsummaryrefslogtreecommitdiff
path: root/RhSolutions.ExcelExtensions/Row.cs
diff options
context:
space:
mode:
Diffstat (limited to 'RhSolutions.ExcelExtensions/Row.cs')
-rw-r--r--RhSolutions.ExcelExtensions/Row.cs33
1 files changed, 33 insertions, 0 deletions
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<TableCell>
+{
+ 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<TableCell> GetEnumerator()
+ {
+ return new RowEnumerator(Range, ParentTable);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
+}