1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
unit FRMvisu_base;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, jpeg, ShellApi;
type
Tvisu_base = class(TForm)
grille: TStringGrid;
procedure FormActivate(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
visu_base: Tvisu_base;
tab: array of array of string;
nb_lig_fich: integer;
implementation
uses timbres,generale;
{$R *.dfm}
//==============================================================
procedure charge_fich();
var
fich_elem: textFile;
lig,mot,foto,num:string;
saut,i,j,y,test: integer;
begin
donnee:= ExtractFilePath(Application.ExeName)+'base_collec_complet.txt';
AssignFile(fich_elem,donnee);Reset(fich_elem);
SetLength(tab,FileSize(fich_elem),20);
nb_lig_fich:=0;
While not EOF(fich_elem) do
begin
ReadLn(fich_elem,lig);saut:=0;mot:='';
nb_lig_fich:=nb_lig_fich+1;
for i:=1 to length(lig) do
begin
if ord(lig[i])<>9 then mot:=mot+char(ord(lig[i]))
else
begin
if saut=0 then
//----------------------------------------------------
begin
mot:=trim(mot);
num:='';y:=length(mot);test:=0;
for j:=1 to y do
begin
if ord(mot[j])<>48 then test:=1;
if test=1 then num:=num+char(ord(mot[j]));
end;
tab[nb_lig_fich,saut]:=num;
end;
//--------------------------------------------------------
if saut=1 then tab[nb_lig_fich,saut]:=trim(mot);
if saut=2 then tab[nb_lig_fich,saut]:=mot;
if saut=3 then tab[nb_lig_fich,saut]:=mot;
if saut=4 then tab[nb_lig_fich,saut]:=mot;
if saut=5 then tab[nb_lig_fich,saut]:=mot;
if saut=6 then tab[nb_lig_fich,saut]:=mot;
if saut=7 then tab[nb_lig_fich,saut]:=mot;
if saut=8 then tab[nb_lig_fich,saut]:=mot;
if saut=9 then tab[nb_lig_fich,saut]:=mot;
if saut=10 then tab[nb_lig_fich,saut]:=mot;
if saut=11 then tab[nb_lig_fich,saut]:=mot;
if saut=12 then tab[nb_lig_fich,saut]:=mot;
if saut=13 then tab[nb_lig_fich,saut]:=mot;
if saut=14 then tab[nb_lig_fich,saut]:=mot;
if saut=15 then tab[nb_lig_fich,saut]:=mot;
if saut=16 then tab[nb_lig_fich,saut]:=mot;
if saut=17 then tab[nb_lig_fich,saut]:=mot;
if saut=18 then tab[nb_lig_fich,saut]:=mot;
if ord(lig[i])=9 then begin saut:=saut+1;mot:=''; end;
end; //fin de else
end;
end;
CloseFile(fich_elem);
end;
//===================================================================
procedure Tvisu_base.FormActivate(Sender: TObject);
var
i:integer;
begin
top:=100;left:=50;
grille.ColWidths[1]:=500;
grille.ColWidths[2]:=100;
grille.Cells[1,0]:='Désignation';
grille.Cells[2,0]:='Année';
charge_fich;
grille.RowCount:=nb_lig_fich+1;
for i:=2 to nb_lig_fich do
begin
grille.Cells[1,i]:=tab[i,1];
grille.Cells[2,i]:=tab[i,4];
end;
end;
//=============================================================== |
Partager