views:

1012

answers:

1

I've created an excel sheet with Delphi 6. Now I have to add a picture to my sheet. Anybody knows how to do that?

+3  A: 

You could try it like this :

procedure InsertPicture(ActiveSheet: OleVariant; ImageFilePath: string: ImageHeight, PictureTop: Integer); 
var
  Picture: OleVariant;
begin
  Picture := ActiveSheet.Pictures.Insert(ImageFilePath);
  Picture.Width := ImageHeight * Picture.Width / Picture.Height;
  Picture.Height := ImageHeight;
  Picture.ShapeRange.Left := 0;
  Picture.ShapeRange.Top := PictureTop;
  Picture.Placement := xlMove;
end;
PatrickvL
Exactly what I needed! Thanks.
Blue