我已经用Delphi 6创建了一个excel工作表。现在我必须在工作表中添加图片。有人知道该怎么做吗?
最佳答案
您可以这样尝试:
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;