2

我已经用 Delphi 6 创建了一个 excel 表。现在我必须在我的表中添加一张图片。有人知道该怎么做吗?

4

1 回答 1

3

你可以这样尝试:

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;
于 2008-11-10T16:14:02.143 回答