Bonjour à tous,
Je suis en train de développer un logiciel permettant d'envoyer des données dans EXCEL. Apres traitement, je récupère les résultats et la couleur de fond de certaines cellules dans un F1book et dans un Chart (polar). Ca tourne pas trop mal MAIS SEULEMENT SUR LE PC QUI ME SERT A DEVELOPPER (celui sur lequel Delphi est installé). Une fois que j'essaie l'application sur un autre PC, j'ai une fenetre qui s'ouvre intitulée "Erreur du programme" avec le texte suivant : "tutu.exe a généré des erreurs et sera fermer par windows. Vous dvrez redémarrer le programme." J'ai essayé sur d'autres pc, meme résultat :(. je suppose que mon application doit avoir besoin de cerftains fichiers mais lequels?????
A tout hasard, je vous montre la source de mon application :
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, VCFI, AxCtrls, OleCtrls, VCF1, OleServer, Excel2000;
type
TForm1 = class(TForm)
F1Book1: TF1Book;
Button1: TButton;
VtChart2: TVtChart;
ExcelApplication1: TExcelApplication;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
monclasseur : _workbook;
mafeuille : _worksheet;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
Procedure F1bookposval(fcol,frow : integer; fval : variant);
begin
F1book1.Col := fcol;
F1book1.Row := frow;
F1book1.number := fval;
end;
var
aleanbr,aleanbr2,resu,coloalea : array[1..11] of double;
coloret : array[1..11] of variant;
resustr : array[1..11] of widestring;
i : integer;
begin
mafeuille:=monclasseur.Worksheets['sheet1'] as _worksheet;
randomize;
for i := 1 to 10 do
begin
aleanbr[i] := random(50);
aleanbr2[i] := random(50);
coloalea[i] := random(32);
Mafeuille.Cells.Item[i,1].value:= aleanbr[i];
Mafeuille.Cells.Item[i,1].Interior.Colorindex:=coloalea[i];
Mafeuille.Cells.Item[i,2].value:= aleanbr2[i];
coloret[i] := Mafeuille.Cells.Item[i,1].Interior.Color;
resu[i] := Mafeuille.Cells.Item[i,3].value ;
F1bookposval(3,i,resu[i]);
F1book1.SetPattern(1,coloret[i],0);
F1bookposval(4,i,coloret[i]);
VtChart2.Column := 2;
VtChart2.Row := i;
str(resu[i],resustr[i]);
VtChart2.data := resustr[i];
end;
VtChart2.Column := 2;
VtChart2.Row := 11;
str(resu[1],resustr[11]);
VtChart2.data := resustr[11];
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
monclasseur := ExcelApplication1.Workbooks.Open(Excelapplication1.getopenfilename(),False,False,
EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,0);
ExcelApplication1.visible[0]:=true;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
monclasseur.close(False, emptyparam,emptyparam,0);
end;
end.
Voilà, merci d'avance ;)
David
