RhSolutions-AddIn/RhSolutions.AddIn/ExcelTable/ExcelRow.cs
2023-03-31 15:27:31 +03:00

34 lines
737 B
C#

using System.Collections;
namespace RhSolutions.ExcelTable;
public sealed class ExcelRow : ExcelTable, IEnumerable<ExcelTableCell>
{
public int Index
{
get => Range.Row - ParentTable.Range.Row;
}
public int Length
{
get => Range.Columns.Count;
}
public ExcelRow(Range range, ExcelTable table) : base(range, table)
{
Range = range;
ParentTable = table;
}
public ExcelTableCell this[int index]
{
get => new(Range.Cells[1, index + 1], ParentTable);
}
public IEnumerator<ExcelTableCell> GetEnumerator()
{
return new ExcelRowEnumerator(Range, ParentTable);
}
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}