procedure TForm1.Button1Click(Sender: TObject);
var
Range : OleVariant;
FontSize : OleVariant;
begin
Range := DHTMLEdit1.DOM.selection.createRange
FontSize := Edit1.Text;
Range.execCommand('FontSize',False,FontSize);
end;
请试一下下面的
Dim doc As Object
Dim sel As Object
Dim tr As Object
' get the DHTML Document object
Set doc = MainForm.DHTMLEdit1.DOM
' get the IE4 selection object
Set sel = doc.selection
' create a TextRange from the current selection
Set tr = sel.createrange
' paste our html into the range
tr.pasteHTML (HTMLText.Text)
Unload Me