- Offizieller Beitrag
Usually the attributes of urls, such as a blue underline, is only temporarily visible. Unlike MS-Word WPTools will not apply a fixed underline mode and color to the text.
If you need this, You can apply the attributes to all linked text elements with just a few lines of code:
Code
procedure HiglightLink(
RTFData: TWPRTFDataCollection;
RTFDataBlock: TWPRTFDataBlock;
par: TParagraph;
obj: TWPTextObj;
param: TObject);
begin
if (obj.ObjType=wpobjHyperlink) and obj.IsStartTag then
begin
RTFData.Cursor.MoveTo(obj);
RTFData.Cursor.SelectToHere(obj.EndTag);
RTFData.Cursor.SelectedTextAttr.IncludeStyle(afsUnderline);
RTFData.Cursor.SelectedTextAttr.SetColor(clBlue);
end;
end;
procedure TForm1.Button18Click(Sender: TObject);
begin
WPRichText1.RTFData.LoopAllObj(nil, HiglightLink, nil);
end;
Alles anzeigen