Reputation: 403
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?
Upvotes: 3
Views: 4373
Reputation: 4164
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;
Upvotes: 3