procedure
TForm1
.
N2Click(Sender: TObject);
var
F:TextFile;
p:
integer
;
str:
string
;
col:
integer
;
str1:
string
;
begin
col:=
0
;
if
OpenDialog1
.
Execute
Then
begin
assignFile(F, OpenDialog1
.
FileName);
Reset(F);
while
not
eof(f)
do
begin
Readln(F, str);
if
length(str)>
3
then
begin
col:=col+
1
;
StringGrid1
.
rowcount:=col+
1
;
StringGrid1
.
Cells[
0
,col]:=IntToStr(col);
p:=
1
;
while
pos(
' '
,str)>
0
do
begin
str1:=copy(str,
1
,pos(
' '
,str)-
1
);
delete(str,
1
,pos(
' '
,str));
StringGrid1
.
Cells[p,col]:=str1;
p:=p+
1
;
end
;
while
pos(
' '
,str)>
0
do
delete(str,pos(
' '
,str),
1
);
StringGrid1
.
Cells[p,col]:=str;
end
;
end
;
CloseFile(F);
end
;
end
;