07-07-2012, 12:33 AM
كود :
var i,i2,i3:integer;
ExcelApp :Variant;
begin
try
ExcelApp:=CreateOleObject('Excel.Application');
abstable2.First;
i:=4;
i2:=1;
i3:=1;
Button3.Caption:=' Excel Open ';
ExcelApp.Workbooks.Add;
while not abstable2.eof do
begin
if i2=1 then
ExcelApp.Cells[i,1].Value:=1
else
ExcelApp.Cells[i,1].Value:=i2;
Button3.Caption:='Insetion :'+inttostr(i3);
ExcelApp.Cells[i,2].Value:=abstable2['matricule'];
ExcelApp.Cells[i,3].Value:=abstable2['nom'];
ExcelApp.Cells[i,4].Value:=abstable2['prenon'];
ExcelApp.Cells[i,5].Value:=abstable2['datedabsence'];
ExcelApp.Cells[i,6].Value:=abstable2['absence'];
abstable2.Next;
i:=i+1;
inc(i2);
inc(i3);
end;
Button3.Caption:='Lancer Excel';
ExcelApp.Visible:=True;
except
showmessage('Impossible de Excute Excel');
end;
end;
