Bonjour a tous,
je suis entrain de migrer mes applications développées sous Delphi 7 vers Delphi 10.3 RIO.
une procédure pour exporter mes données vers Excel on utilisant le composant ExcelApplication1 ,
cette procédure marche très très bien sous delphi 7 mais pas du tout sous delphi 10.3 ![:oops:](https://www.developpez.net/forums/images/smilies/icon_redface.gif)
voici le morceau de la procédure :
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
| procedure TFNouveauBL.ExportExcelClick(
Sender: TObject);
var Tab: _workbook;
Feuil: _worksheet;
i,j:Integer;
S:shortstring;
begin
try
LeDetailBL.Close ;
LeDetailBL.ParamByName('N').AsString := NumBon.Text ;
LeDetailBL.Open ;
ExcelApplication1.Connect;
ExcelApplication1.Visible[0]:=False;
Tab:=ExcelApplication1.Workbooks.Add(xlWBATWorksheet,0);
//ExcelApplication1.Visible[0]:=true;
feuil := Tab.Worksheets[1] as _worksheet;
For i:=0 to LeDetailBL.FieldCount-1 do
begin
with Feuil.Range[MonTableau[i+1]+'12',MonTableau[i+1]+'12'] do
begin
Value[xlRangeValueDefault]:= LeDetailBL.Fields.Fields[i].DisplayLabel;
Font.Name:='times new roman';
Font.Size:=10;
Font.Bold:=True;
With Interior do
begin
ColorIndex := 15;
Pattern := xlSolid;
PatternColorIndex := xlAutomatic;
End;
With Borders do
begin
LineStyle := xlContinuous;
Weight := xlThin;
ColorIndex := xlAutomatic;
End;
end;
end;
finally
ExcelApplication1.Visible[0]:=true;
ExcelApplication1.Cells.Select;
ExcelApplication1.Columns.AutoFit;
ExcelApplication1.Range['A1','A1'].Select;
ExcelApplication1.Disconnect;
LeDetailBL.Close ;
end;
end; |
à la ligne :
Value[xlRangeValueDefault]:= LeDetailBL.Fields.Fields[i].DisplayLabel;
j’obtiens cette erreur
[dcc32 Erreur] E2064 La partie gauche n'est pas affectable
avez vous une idée SVP?
Partager