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
   |    [...]
 
   uses  [...] Excel2000 [...];
 
 
 
procedure TFrmResultat.btn_convertClick(Sender: TObject);
 var
   filename        :  textFile;
   fichierexcel    : String;
   fichierexcelole : OleVariant;
   lignetemporaire : String;
   datetemporaire  : TDateTime;
   MonClasseur     : OleVariant;
   MaFeuille       : OleVariant;
   LCID            : integer;
 begin
   LCID := GetUserDefaultLCID;
   // On ouvre le fichier texte de résultat
   assignFile(filename,fichier);
   reset(filename);
   // si le fichier excel n'est pas encore créé on le copie dans le dossier de la campagne
   fichierexcel := 'c:\Scenario\Campagnes\' + ComboBoxResultat.Text + '\Resultats\Essai.xls';
   if not(FileExists(fichierexcel)) then
       CopyFile(PChar('C:\Scenario\Scenars\Excel\Essai.xls'),
               PChar(fichierexcel),
               False);
 
    // On se connecte à excel et on ouvre le fichier excel
    ExcelApplication1.Connect;
    MonClasseur:= ExcelApplication1.Workbooks.Open(fichierexcel,
                  EmptyParam,EmptyParam,EmptyParam,
                  EmptyParam,EmptyParam,EmptyParam,
                  EmptyParam,EmptyParam,EmptyParam,
                  EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,LCID);
 
 
    ExcelApplication1.Visible[LCID] := true; | 
Partager