Fabrice Vendé

Hello,
How to add a picture (image) by code ?
I have to tried do it like this :
procedure TForm1.ToolButton2Click(Sender: TObject);
var
D: IDispatch;
ControlRange:IHTMLControlRange;
ImgElement: IHTMLImgElement;
begin
if Editor.CanInsertImage then
begin
if Editor.GetDOM(D) then
try
Element:=(D as IHTMLDocument2).createElement('img');
ImgElement:=(Element) as IHTMLImgElement;
ImgElement.src:= Lien;
ImgElement.alt:= Alternatif;
ImgElement.align:= Alignement;
ImgElement.border:= LargeurBordure;
ImgElement.hspace:= MargeHorizontale;
ImgElement.vspace:= MargeVerticale;
except
end;
end;
end;
But it doesn't seems to work !
I know how to update a picture by code but not to add one.
Best regards,
-
Fabrice