Fórum Componente de editor HTML #193209
06/11/2003
0
[url]http://www.cadfmtm.com.br/fckeditor/_test/test.asp[/url]
obrigado.
Mr_joni
Curtir tópico
+ 0Posts
06/11/2003
Bampavao
http://www.clubedelphi.com.br/compo/download.asp?id=101
Gostei + 0
06/11/2003
E_gama
Vá em Components/Import Activex Control
Localize [b:3850951650]DTHML Edit ...[/b:3850951650], e em seguida clique em [b:3850951650]Install[/b:3850951650]
Depois disso, haverá dois novos componentes na paleta [b:3850951650]ActiveX[/b:3850951650]
Para testar, crie as duas procedures abaixo no seu form:
private
{ Private declarations }
procedure SetHTMLProperty(const Name: String; Value : OleVariant);
function GetHTMLProperty(const Name: String) : OLEVariant;
.
.
.
procedure TFrmEditorHTML.SetHTMLProperty(const Name: String; Value: OleVariant);
var V: OleVariant;
begin
V := DHTMLEdit1.DOM.selection.createRange;
V.execCommand(Name , False, Value);
end;
function TFrmEditorHTML.GetHTMLProperty(const Name: String): OLEVariant;
var V: OleVariant;
begin
V := DHTMLEdit1.DOM.selection.createRange;
Result := V.queryCommandValue(Name);
end;
Adicionar em Uses da Implementation:
[b:3850951650]uses MSHTML_TLB[/b:3850951650];
Cheque também a Uses da Interface:
[b:3850951650]uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, DHTMLEDLib_TLB, StdCtrls, ExtCtrls, Buttons, ComCtrls,
ToolWin, IEConst, MSHTML, ComObj, ExtDlgs;
[/b:3850951650]
Depois é só aplicar os comandos, por exemplo:
Itálico:
SetHTMLProperty(´Italic´, True); // ou False
Negrito:
SetHTMLProperty(´Bold´, True);
Sublinhado:
SetHTMLProperty(´Underline´, True);
Alinhamento à esquerda:
SetHTMLProperty(´JustifyLeft´, True);
Centralizar:
SetHTMLProperty(´JustifyCenter´, True);
Alinha à direita:
SetHTMLProperty(´JustifyRight´, True);
Trocar a fonte:
SetHTMLProperty(´FontName´, NomedaFonte);
Tamanho da fonte:
SetHTMLProperty(´FontSize´, Tamanho);
Carregar um documento HTML:
DHTMLEdit1.BaseURL := ExtractFilePath(NomeArquivo); DHTMLEdit1.LoadDocument(NomeArquivo); while DHTMLEdit1.Busy do Application.ProcessMessages;
Salvar o documento:
DHTMLEdit1.SaveDocument(NomeArquivo);
Esses são alguns comandos, mas se vc pesquisar pela Net, encontrará mais detalhes, como adicionar uma imagem, criar um link, etc...
Gostei + 0
06/11/2003
Mr_joni
Gostei + 0
06/11/2003
E_gama
[url]http://www.euromind.com/iedelphi/index.htm[/url]
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)