Fórum Componente do tipo RichEdit, mais inovador ??? #254318
13/10/2004
0
Agradeço que me ajudar!!!
Faelcavalcanti
Curtir tópico
+ 0Posts
13/10/2004
Bon Jovi
Gostei + 0
14/10/2004
Faelcavalcanti
Daí também gostaria de extrair todo o conteúdo digitado e exportar para HTML, ou que fosse da mesma forma como o editor de digitação de texto da Hotmail. Alguém sabe essa, ou pelo menos poderia me dar uma força!
:roll:
Gostei + 0
14/10/2004
Nildo
No evento OnClick de um botão você coloca assim:
RichEdit1.SelAttributes.Color := clRed;
dai você vai pro richedit e começa a digitar. Td q vc digitar a partir dali vai ficar vermelho. Essa regra atribue também se você tem um texto selecionado e executar esse comando, sómente o texto selecionado fica em vermelho.
Gostei + 0
14/10/2004
Faelcavalcanti
Utilizei o seguinte procedimento para formatá-lo :
DopCol: TColor);
var
i, iDop: Integer;
s: string;
Col: TColor;
isTag, isDop: Boolean;
begin
iDop := 0;
isDop := False;
isTag := False;
Col := TextCol;
RichEdit.SetFocus;
for i := 0 to Length(RichEdit.Text) do
begin
RichEdit.SelStart := i;
RichEdit.SelLength := 1;
s := RichEdit.SelText;
if (s = ´<´) or (s = ´{´) then
isTag := True;
if isTag then
if (s = ´"´) then
if not isDop then
begin
iDop := 1;
isDop := True;
end
else
isDop := False;
if isTag then
if isDop then
begin
if iDop <> 1 then Col := DopCol;
end
else
Col := TagCol
else
Col := TextCol;
RichEdit.SelAttributes.Color := Col;
iDop := 0;
if (s = ´>´) or (s = ´}´) then
isTag := False;
end;
RichEdit.SelLength := 0;
end;
Em seguida efetuo os seguintes procedimentos :
RichEdit1.Lines.BeginUpdate; HTMLSyntax(RichEdit1, clBlue, clRed, clGreen); RichEdit1.Lines.EndUpdate;
O Problema é que terei que fazê-lo após toda a digitação, pois após efetuar estes procedimentos ele não deixa eu impor cores, e/ou qualquer coisa que seja relativo a formatação de texto
Como posso então gerar um arquivo HTML, com um texto já pronto.
Talvez eu terei que montar na mão, sei lá usar a TAG <DIV>.
Me Ajudem!!!
Gostei + 0
14/10/2004
Faelcavalcanti
procedure HTMLSyntax(RichEdit: TRichEdit; TextCol, TagCol, DopCol: TColor);
var
i, iDop: Integer;
s: string;
Col: TColor;
isTag, isDop: Boolean;
begin
iDop := 0;
isDop := False;
isTag := False;
Col := TextCol;
RichEdit.SetFocus;
for i := 0 to Length(RichEdit.Text) do
begin
RichEdit.SelStart := i;
RichEdit.SelLength := 1;
s := RichEdit.SelText;
if (s = ´<´) or (s = ´{´) then
isTag := True;
if isTag then
if (s = ´"´) then
if not isDop then
begin
iDop := 1;
isDop := True;
end
else
isDop := False;
if isTag then
if isDop then
begin
if iDop <> 1 then Col := DopCol;
end
else
Col := TagCol
else
Col := TextCol;
RichEdit.SelAttributes.Color := Col;
iDop := 0;
if (s = ´>´) or (s = ´}´) then
isTag := False;
end;
RichEdit.SelLength := 0;
end;
Gostei + 0
14/10/2004
Marcelo Saviski
O texto digitado no ynEdit ficará formatado reaçando tags ou textos etc.
Não é só p/ HTML, tem para trocentas linguagens.
Muito bom.
Gostei + 0
14/10/2004
Bon Jovi
Solução 2: Usar Editor DHTML, que trabalha diretamente com HTML.
Gostei + 0
22/10/2004
Faelcavalcanti
Rapaz este componente é realmente, espetacular!!!!!
Não tenho muito a falar é só conferir!!!!
Mas ainda há uma dúvida, gostaria de formatar várias vezes um TRichEdit ou outro componente, ou talvez este do SynEdit. Não testei ainda.
Mas o que eu queria de fato é Formatar de diversos tamanhos e cores um texto digitado.
Agradeço pela ajuda de todos!!!
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)