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
|
procedure Ajout_Vignette(PCol :integer);
var
vMSLeft, vMSTop, vMSWidth, vMSHeight :integer;
Pict :TPicture;
begin
// Ajout des vignettes
Fic_Vign := Rep_Vignette.Text + '\' +Code_Art + '.jpg';
if FileExists(Fic_Vign) then
begin
Pict := TPicture.Create;
try
// Récupère les dimensions de l'image
Pict.LoadFromFile(Fic_Vign);
// Redimensionne proportionellement l'image
vMSHeight:=Round(Max_Height.Value);
vMSWidth := Round(Pict.Width * (vMSHeight / Pict.Height));
finally
if Assigned(Pict) then
Pict.Free;
end;
// Position de l'image par rapport à la cellule
vMSLeft:=SheetSource.cells.item[ligne, PCol].Left + 3;
vMSTop:=SheetSource.cells.item[ligne, PCol].top + 3;
// Ajout des images avec insertion dans le fichier xls final
SheetSource.Shapes.AddPicture(Fic_Vign, msoFalse, msoTrue, vMSLeft, vMSTop, vMSWidth, vMSHeight); // uses officexp
// Agrandi la hauteur de ligne en fonction de l'image
SheetSource.cells.item[ligne, PCol].EntireRow.RowHeight:=vMSHeight + 6;
end;
end; |
Partager