I am having problems converting HTML to RTF. I uploaded the problematic files (original HTML and the resulting RTF) to http://www.dimastr.com/temp/conversion_problem.zip.
The relevant snippet of code is below
RvHtmlImporter := TRvHtmlImporter2.Create(Msg);
RVReportHelper := TRVReportHelper.Create(nil);
canvas:= TCanvas.Create;
RVStyle:= TRVStyle.Create(nil);
try
canvas.Handle := GetWindowDC (GetDesktopWindow);
RVReportHelper.RichView.Style := RVStyle;
RVReportHelper.RichView.OnReadHyperlink := RvHtmlImporter.OnReadHyperlink;
RVReportHelper.RichView.OnWriteHyperlink := RvHtmlImporter.OnWriteHyperlink;
RVReportHelper.Init(canvas, Screen.Width);
//RvHtmlImporter.RichView := TempRichView;
RvHtmlImporter.RichView := RVReportHelper.RichView;
RvHtmlImporter.ClearDocument := false;
RvHtmlImporter.BasePath := '';
RvHtmlImporter.LoadHtml(Value);
Stream := TMemoryStream.Create;
try
RVReportHelper.RichView.SaveRTFToStream(Stream, false);
if Stream.Size > 0 then begin
Stream.Position := 0;
SetLength(Result, Stream.Size);
Stream.Read(Result[1], Length(Result));
end;
bRtfConverted := true;
finally
Stream.Free;
end;
finally
RvHtmlImporter.Free;
RVStyle.Free;
RVReportHelper.Free;
canvas.Free;
end;
RTF to HTML conversion
Looks like the link included an extra dot. The correct link is http://www.dimastr.com/temp/conversion_problem.zip .
-
- Site Admin
- Posts: 17565
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: