VBCommons/excel/API_XLRecordsWrapper.cls
2024-06-07 20:46:40 +03:00

50 lines
1.1 KiB
OpenEdge ABL

VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "API_XLRecordsWrapper"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
' ==== Îáîëî÷êà äëÿ ëèñòà Excel êàê èñòî÷íèêà çàïèñåé äàííûõ =========
' Shared module version: 20210329
' Depends on:
' Required reference:
' Prerequisites: first column should contain data with no empty cells
Option Explicit
Private data_ As Excel.Worksheet
Private row_ As Long
Private start_ As Long
Public Function Init(ws As Excel.Worksheet, Optional nStart& = 2)
start_ = nStart
Set data_ = ws
Call MoveStart
End Function
Public Function MoveStart()
row_ = start_
End Function
Public Function IsDone() As Boolean
IsDone = data_.Cells(row_, 1) = vbNullString
End Function
Public Function MoveNext() As Boolean
MoveNext = Not IsDone
If MoveNext Then _
row_ = row_ + 1
End Function
Public Function MovePrev() As Boolean
MovePrev = row_ > start_
If MovePrev Then _
row_ = row_ - 1
End Function
Public Function Field(nColumn&) As Excel.Range
Set Field = data_.Cells(row_, nColumn)
End Function