Hi
I always have an error when I close my application after do it:
aTable:= TRVTableItemInfo.CreateEx(1,1, Rve.RVData);
if Image1.Picture.graphic<> nil then begin
aTable.Cells[0,0].Clear;
aTable.Cells[0,0].AddPictureEx(aName,Image1.Picture.Graphic,-1,rvvaBaseline);
rve.InsertItem('',aTable);
Regards
InsertTable with image
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
You need to create a copy of graphic, because TRichView frees inserted images.
PS: documents (and cells) must not start from item continuing paragraph (ParaNo=-1); this error is fixed automatically, but for any case, I changed -1 to 0.
Code: Select all
var gr: TGraphic;
aTable:= TRVTableItemInfo.CreateEx(1,1, Rve.RVData);
if Image1.Picture.graphic<> nil then begin
aTable.Cells[0,0].Clear;
// RV_CreateGraphics is defined in RVFuncs.pas
gr := RV_CreateGraphics(TGraphicClass(Image1.Picture.Graphic.ClassType));
gr.Assign(Image1.Picture.Graphic);
aTable.Cells[0,0].AddPictureEx(aName,gr,0,rvvaBaseline);
end;
rve.InsertItem('',aTable);