I have Delphi 7 Pro.
I have tried to download some code from the net, but none of them works.
I need to convert RTF from TRichEdit control to HTML.
Is there any good sample out there?
I dont need any shareware stuff.
Thanks in advanced
Best regards
Viggo Jamne
Norway
I have only these two URLs on file on the subject. Never looked at them
myself, though.
Converting RTF to HTML
http://meteortech.com/ScholarSoft/delphi/
http://www55.pair.com/betasoft/indexp1.html#12
If you have MS Word installed you can perhaps use it via OLE automation to
perform the conversion.
--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
They have a component: JvRichEditToHtml
"Viggo Jamne" <fi...@norprog.no> escribió en el mensaje
news:3eae...@newsgroups.borland.com...
But it donsent work to well with bullets and numbers.
I have to go into the code and see if i can figure it out.
So, none of the source out there have worked for me jet.
Is there a sample for HTML to RTF somewhere do you think?
Best Regards
Viggo Jamne
"Alejandro Castro" <alej...@alfra.info> wrote in message
news:3eaf3586$1...@newsgroups.borland.com...
function TJvRichEditToHtml.ConvertToHtmlstringList(Value: TRichEdit):
TStringList;
var
i, j: Integer;
datt, att, currat: TFont;
dpara, para, currpara: TJvParaAttributes;
st: string;
FEnd: string;
begin
Value.Lines.BeginUpdate;
Result := TStringList.Create;
Result.Add(RC_Html1);
Result.Add(RC_Html7);
Result.Add(RC_Html3);
datt := TFont.Create;
att := TFont.Create;
currat := TFont.Create;
dpara.Alignment := taLeftJustify;
dpara.Numbering := nsNone;
currpara.Alignment := dpara.Alignment;
currpara.Numbering := dpara.Numbering;
FendPara := '';
datt.Assign(Value.DefAttributes);
Result.Add(AttToHtml(datt));
FEnd := FEndSection;
// k := 0;
Currat.Assign(datt);
FEndSection := '';
st:='';
i:=0;
j:=0;
while i<=Length(Value.Text) - 1 do begin
if Value.Text[i]=#0 then begin
inc(j);
end
else begin
if Value.Text[i]=#13 then begin
if Value.Text[i+1]=#10 then begin
st:=st+RC_Html4;
Result.Add(st);
Application.ProcessMessages;
st:='';
inc(i);
end;
end
else begin
Value.SelStart := i-j;
Value.SelLength := 1;
att.Assign(Value.SelAttributes);
para.Alignment := Value.Paragraph.Alignment;
para.Numbering := Value.Paragraph.Numbering;
if Diff(att, currat) then begin
st := st + FEndSection;
currat.Assign(att);
st := st + AttToHtml(att);
end;
if DiffPara(para, currpara) then begin
st := st + FEndPara;
currpara.Alignment := para.Alignment;
currpara.Numbering := para.Numbering;
st := st + ParaToHtml(para);
end;
st := st + FCharToH.CharToHtml(Value.Text[i]);
end;
end;
inc(i);
end;
if st<>'' then
Result.Add(st);
datt.Free;
att.Free;
currat.Free;
Result.Add(FEnd);
Result.Add(RC_Html5);
Result.Add(RC_Html6);
Value.Lines.EndUpdate;
end;
"Viggo Jamne" <fi...@norprog.no> escribió en el mensaje
news:3eaf...@newsgroups.borland.com...
Your new function didn't work either.
I only got the first bullet. The <LI> parameter was just present on the
first bullet in the HTML code.
I didn't fint then FCharToH Record or class, so i changed it back to
orginal.
I changed a bit on the function.
Now it works for me :)
Here is the canges.
function TJvRichEditToHtml.ConvertToHtmlstringList(Value: TRichEdit):
TStringList;
var
i, j: Integer;
datt, att, currat: TFont;
dpara, para, currpara: TJvParaAttributes;
st: string;
FEnd: string;
Bullets : Boolean; file://Changes for bullets to work .... Viggo
Jamne(01.05.2003)
file://Changes for bullets to work .... Viggo Jamne(01.05.2003)
if st = '' then
if (Bullets) then
st := st + RC_LeftIndent;
file://....Changes end
if Diff(att, currat) then begin
st := st + FEndSection;
currat.Assign(att);
st := st + AttToHtml(att);
end;
if DiffPara(para, currpara) then begin
file://Changes for bullets to work .... Viggo Jamne(01.05.2003)
if para.Numbering <> nsNone then
Bullets := True
else
Bullets := False;
file://....Changes end
st := st + FEndPara;
currpara.Alignment := para.Alignment;
currpara.Numbering := para.Numbering;
st := st + ParaToHtml(para);
end;
st := st + CharToHtml(Value.Text[i]);
end;
end;
inc(i);
end;
if st<>'' then
Result.Add(st);
datt.Free;
att.Free;
currat.Free;
Result.Add(FEnd);
Result.Add(RC_Html5);
Result.Add(RC_Html6);
Value.Lines.EndUpdate;
end;
"Alejandro Castro" <alej...@alfra.info> wrote in message
news:3eaf...@newsgroups.borland.com...
"Viggo Jamne" <fi...@norprog.no> wrote in message
news:3eb0...@newsgroups.borland.com...