Pasting hyperlinks
Posted: Tue Mar 21, 2006 1:27 pm
Hi there,
I have a problem when text containing hyperlinks is pasted from OpenOffice. I copy something like this:
This is a test
http://hotpot.uvic.ca/
Finished.
where the middle line is a link to the visible URL. In my TRichViewEdit, I see the text of the link interspersed with square-box characters (the way WideStrings sometimes appear when they are pasted into an 8-bit text box). If I copy/paste from the TRichViewEdit, the text is OK again (so I can't paste it here!). The URL of the link is correctly preserved. My OnPasteHyperlink looks like this:
procedure TMarkRichView.RVEReadHyperlink(Sender: TCustomRichView; const Target,
Extras: string; DocFormat: TRVLoadFormat; var StyleNo, ItemTag: Integer;
var ItemName: string);
begin
ItemTag := Integer(StrNew(PChar('href="' + Target + '"')));
StyleNo := tsHyperlink;
end;
It looks as though the actual text of the item, which is Unicode, is being treated as if it's not Unicode. Do you have any idea what might be causing this, or how I can avoid it?
Cheers,
Martin
I have a problem when text containing hyperlinks is pasted from OpenOffice. I copy something like this:
This is a test
http://hotpot.uvic.ca/
Finished.
where the middle line is a link to the visible URL. In my TRichViewEdit, I see the text of the link interspersed with square-box characters (the way WideStrings sometimes appear when they are pasted into an 8-bit text box). If I copy/paste from the TRichViewEdit, the text is OK again (so I can't paste it here!). The URL of the link is correctly preserved. My OnPasteHyperlink looks like this:
procedure TMarkRichView.RVEReadHyperlink(Sender: TCustomRichView; const Target,
Extras: string; DocFormat: TRVLoadFormat; var StyleNo, ItemTag: Integer;
var ItemName: string);
begin
ItemTag := Integer(StrNew(PChar('href="' + Target + '"')));
StyleNo := tsHyperlink;
end;
It looks as though the actual text of the item, which is Unicode, is being treated as if it's not Unicode. Do you have any idea what might be causing this, or how I can avoid it?
Cheers,
Martin