Adding images

This code adds the same image to the cells A1 and A5. The image is saved only once in the document:
uses
  {...}, OExport, OExport_Vcl, OExport_Vcl;

procedure TForm1.BtnTestClick(Sender: TObject);
var
  xExport: TOExport;
  xLogoIndex: Integer;
begin
  xExport := TOExport.Create;
  try
    with xExport.AddWorkSheet('Image test') do begin
      with AddRow do begin//1
        with AddCellString do begin//A1
          xLogoIndex := AddImage(docDir+'kluug-logo-128.png', 0, 0, 200, 50).DrawingIndex;
        end;
      end;
      AddRow;//2
      AddRow;//3
      AddRow;//4
      with AddRow do begin//5
        with AddCellString do begin//A5
          ReuseImage(xLogoIndex, 0, 0, 400, 100);
        end;
      end;
    end;

    xExport.SaveToFileWithDialog;
  finally
    xExport.Free;
  end;
end;
Categories