HotXLS Delphi Excel Read Write Library / Component Developers Guide loslab Inc.

Use image Sample

This example demonstrates how to add images into excel file

Screenshot

Source code

var book: IXLSWorkbook;
begin
  //create Workbook object
  book := TXLSWorkbook.Create;
  //Add new Worksheet
  with book.Sheets.Add do begin
    //Change name of Worksheet
    Name := 'Sheet with image';
    //select upper-left corner ("B3") for image
    Cells[3,2].Select;
    //Add picture into sheet
    Shapes.AddPicture('image1.jpg');
  end;
  //Save Workbook
  book.SaveAs('book.xls');
  MessageDlg('book.xls is created', mtInformation, [mbOk], 0);
end;

See also

TXLSShapes class
AddPicture method
IXLSWorksheet.Shapes property
Copyright©2007-2019 loslab.com