hyperlink problem
Posted: Sun May 16, 2010 2:19 pm
Hi,
I am having a problem with hyperlinks.
Here is the scenario I am using :
I have a Form with a TRichView which displays the text. The text comes from RVF format. To edit the text, I open another form with a TRichViewEdit component and copy the text from the viewer to the editor as follows :
procedure TFrameRTFViewer.CopyToEditor(Editor: TRichViewEdit);
var
M: TMemoryStream;
begin
M := TMemoryStream.Create;
try
rvBody.SaveRVFToStream(M, False);
M.Position := 0;
Editor.LoadRVFFromStream(M);
Editor.Reformat;
finally
M.Free;
end;
end;
I then create hyperlinks on the text in the editor. The Target of the hyperlink is formatted in a string as '{guid string};1'
When I click Save , the content is copied back from editor to viewer :
procedure TFrameRTFViewer.CopyFromEditor(Editor: TRichViewEdit);
var
M: TMemoryStream;
begin
M := TMemoryStream.Create;
try
Editor.SaveRVFToStream(M, False);
M.Position := 0;
rvBody.LoadRVFFromStream(M);
rvBody.Reformat;
finally
M.Free;
end;
end;
The problem is that the hyperlinks are not saved correctly.
Both viewer and editor have rvoTagsArePChars = True. RVFOptions are set the same as well.
It seems all hyperlinks receive the same Target tag. However, I debugged the code tracking RVFSaveTag, and they were saved correctly. They just don't load correctly.
Strange problem, I can't figure it out.
I am having a problem with hyperlinks.
Here is the scenario I am using :
I have a Form with a TRichView which displays the text. The text comes from RVF format. To edit the text, I open another form with a TRichViewEdit component and copy the text from the viewer to the editor as follows :
procedure TFrameRTFViewer.CopyToEditor(Editor: TRichViewEdit);
var
M: TMemoryStream;
begin
M := TMemoryStream.Create;
try
rvBody.SaveRVFToStream(M, False);
M.Position := 0;
Editor.LoadRVFFromStream(M);
Editor.Reformat;
finally
M.Free;
end;
end;
I then create hyperlinks on the text in the editor. The Target of the hyperlink is formatted in a string as '{guid string};1'
When I click Save , the content is copied back from editor to viewer :
procedure TFrameRTFViewer.CopyFromEditor(Editor: TRichViewEdit);
var
M: TMemoryStream;
begin
M := TMemoryStream.Create;
try
Editor.SaveRVFToStream(M, False);
M.Position := 0;
rvBody.LoadRVFFromStream(M);
rvBody.Reformat;
finally
M.Free;
end;
end;
The problem is that the hyperlinks are not saved correctly.
Both viewer and editor have rvoTagsArePChars = True. RVFOptions are set the same as well.
It seems all hyperlinks receive the same Target tag. However, I debugged the code tracking RVFSaveTag, and they were saved correctly. They just don't load correctly.
Strange problem, I can't figure it out.