Page 1 of 1

How read from Excel rows row by row with images with XLSRead

Posted: Wed Aug 16, 2017 6:26 am
by mrUlugbek
Hi All
I need help
How read from Excel rows row by row with images with XLSReadWriteII?
I have excel file with goods list with image how read and import to database?
Can you give sample?

Re: How read from Excel rows row by row with images with XLSRead

Posted: Sun Aug 20, 2017 8:26 pm
by larsa
Hello

Loop trough the Images object of the Drawing object and check the Row1 and Row2 properties of the images. Please study the Pictures sample for more details.

Re: How read from Excel rows row by row with images with XLSRead

Posted: Mon Aug 21, 2017 5:41 am
by mrUlugbek
Can you make little bit source or example i found other example but comobj

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var
  ExcelObj:OleVariant;
  SheetObj:OleVariant;
  CellObj:OleVariant;
  i:integer;
  pict_count:integer;
  pict: TPicture;
begin
  ExcelObj := CreateOleObject('excel.application');
  ExcelObj.Application.DisplayAlerts:=False;
  ExcelObj.Workbooks.Open(ExtractFilePath(application.ExeName)+  'Book1.xlsx');
  SheetObj:=ExcelObj.Workbooks[1].Sheets[1];
  pict_count:=sheetObj.Pictures.Count;
  for i := 0 to pict_count-1 do begin
    CellObj:=SheetObj.Pictures[i+1].TopLeftCell;
   
    //for log
    Memo1.Lines.Add(format('[ %d , %d ]',[integer(CellObj.Row),integer(CellObj.Column)])) ;
   
    SheetObj.Pictures[i+1].select;
    SheetObj.Pictures[i+1].copy;

    if Clipboard.HasFormat(CF_PICTURE) then begin
      pict := TPicture.Create;
      try
        pict.Assign(Clipboard);
        pict.SaveToFile(format('%s',[SheetObj.Pictures[i+1].Name]));
        pict.Free; 
      except
      // Can't convert
      end;
    end;
  end;

  SheetObj:=unassigned;
  CellObj:=unassigned;
  ExcelObj.Quit;
  ExcelObj:=unassigned;
end;

But i want how do this by your lib?