const
ArtCol = 1;
var
Excel : Variant;
Article : string;
Stop : Boolean;
i : Integer;
StartRow : Integer;
function IsEmptyRow(Row : Integer) : Boolean;
begin
Result := True;
Article := Excel.Sheets[1].Cells[Row, ArtCol].Text;
if (Article <> '') then
Result := False;
end;
begin
if OpenDialogData.Execute then begin
try
Excel := CreateOleObject('Excel.Application');
Excel.Visible := False;
Excel.Workbooks.Open(OpenDialogData.FileName);
Application.ProcessMessages;
Stop := False;
i := 0;
while not Stop do begin
if not IsEmptyRow(i) then
Article := Excel.Sheets[1].Cells[i, ArtCol].Text
else
if IsEmptyRow(i + 1) then
Stop := True;
Inc(i);
Application.ProcessMessages;
end;
finally
Excel.Quit;
end;
end;
end;