Answer the question
In order to leave comments, you need to log in
I create a text converter from Richedit (properties (bold, italic...) to html code, what's wrong?
procedure TForm4.Button2Click(Sender: TObject);
var
x{счётчик жирных символов},i{строки},j{Символы},n{количество дополнительных символов(теги)}:integer;
begin
x:=-1;
n:=0;
for i := 0 to RichEdit1.Lines.Count-1 do
for j := 0 to Length(RichEdit1.Lines[i]) do
begin
richedit1.SelStart:=j;{фокус на символе}
label4.caption:=inttostr(n);
label3.caption:=inttostr(j);
label5.caption:=inttostr(x);
if RichEdit1.SelAttributes.Style=[fsBold]{если символ жирный} then
begin
x:=x+1;
if x=0 then
begin
memo1.SelStart:=j+n-1;
memo1.SelText:='<br>';
n:=n+4;
end
else
if x>0 then
if RichEdit1.SelAttributes.Style<>[fsBold]{если символ не жирный} then
begin
memo1.SelStart:=j+n;
memo1.SelText:='</br>';
x:=-1;
n:=n+5 ;
end;
end;
end;
label1.caption:=inttostr(x);
n:=n+1;
end;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question