Y
yfoxyfox
Unregistered / Unconfirmed
GUEST, unregistred user!
delphi读取excel文件,文件中包含多个图片,如何处理?var i, j, idx: Integer; AExcel, ASheet: Variant; sText: string;begin try AExcel := CreateOleObject('Excel.Application'); try AExcel.DisplayAlerts := False; AExcel.Workbooks.Open('E:/Temp/test.xls'); for i := 1 to AExcel.Workbooks.Count do begin ASheet := AExcel.Worksheets;//读图片(Pictures) for j := 1 to ASheet.Pictures.Count do begin //看不到count数量 ASheet.Pictures[j].Copy; //虽然有多个图片,但是j>1时报错 if Clipboard.HasFormat(CF_PICTURE) then begin Clipboard.Open; try Image1.Picture.Assign(Clipboard); //借助于剪贴板 finally Clipboard.Close; end; end; end; end; finally AExcel.Quit; AExcel := Unassigned; end; except on E: Exception do ShowMessage(E.Message); end;