How to Insert BMP

hello everyone,

I'm using TAdvGridWorkbook on Delphi10.

I wanna insert the BMP to a cell.
How to do it ?

for example by Excel Macro
ActiveSheet.Pictures.Insert("C:\temp.bmp").Select

best reguards,
Taro

Set the active sheet with AdvGridWorkBook.ActiveSheet property and then you can access the grid on the active sheet with

AdvGridWorkbook.Grid.AddBitmap() to insert a bitmap in a cell of that grid.
Thank you very much for your detailed information.
But I could not solve it.

For example, create a form as shown below...
https://i.gyazo.com/0bef796618c8e6197b73404ff72f9705.png

And, when coding as follows...
What should I specify underlined parts?

procedure TForm1.Button1Click(Sender: TObject);
var
  bmp : tBitmap;
  Dc  : HDC;
  R   : TRect;
  cnt : Integer;
begin
  DC := GetDC ( Panel1.handle);
  R := Panel1.Controls[0].boundsRect;
  bmp := tBitmap.create;
  bmp.width := R.Right-R.Left;
  bmp.Height := R.Bottom - R.Top;
  Bitblt(bmp.canvas.handle,0,0,bmp.Width,bmp.height,dc,r.left,r.top,srccopy);
  bmp.saveToFile ('c:\aaa.bmp');

  AdvGridWorkbook1.Grid.AddBitmap(1,1,bmp,False,____,___);
  bmp.free;

  ReleaseDC(panel1.handle,dc);
end;


best reguards,
Taro
Ooops, I made a mistake in the URL of the image.

Below is the correct URL.
https://i.gyazo.com/58e9bd7a946831a126590b329ec6d2a4.png

You create a bitmap and you add it and then destroy the bitmap, so the bitmap will disappear again.

If you want the grid to continue managing the bitmap, please change the code to:
procedure TForm1.Button1Click(Sender: TObject);
var
  bmp : tBitmap;
  Dc  : HDC;
  R   : TRect;
  cnt : Integer;
begin
  DC := GetDC ( Panel1.handle);
  R := Panel1.Controls[0].boundsRect;
  bmp := tBitmap.create;
  bmp.width := R.Right-R.Left;
  bmp.Height := R.Bottom - R.Top;
  Bitblt(bmp.canvas.handle,0,0,bmp.Width,bmp.height,dc,r.left,r.top,srccopy);
  bmp.saveToFile ('c:\aaa.bmp');

  AdvGridWorkbook1.Grid.CreateBitmap(1,1,bmp,False,_,).Assign(bmp);
  bmp.free;

  ReleaseDC(panel1.handle,dc);
end;

Bruno Fierens2017-03-13 17:47:38
Oh, I see . thank you very much.
but my quiestion is not solved.

About the underlined part.
AdvGridWorkbook1.Grid.CreateBitmap(1,1,bmp,False,____,___).Assign(bmp);

what are hal,val. I don't know what to write concretely there.please tell me the code.

best regards,
Taro



Please see page 66 in the pdf developers guide


Succeeded with the following code.
I close this question. Thank you very much.

uses  , AdvGrid
AdvGridWorkbook1.Grid.CreateBitmap(1,3,False,haLeft,vaTop).Assign(bmp);