Posted by a ceTe Software moderator
Hello Chinmaya,
The combination of Link and Label elements can give the feel of a hyperlink. The Link element can take different Actions. Please go through the help documentation about
Actions and
XYDestination.
Currently, it is not possible to make a random word as a link directly from a text area or a line. However, you could handle it by calculating the text width till the actual Link and add the Link at that location. You can get the text width by using the
Font.GetTextWidth method.
Pseudo-code could be.
float firstTextWidth = font.GetTextWidth("This is some text having a link, ", fontSize);
Label firstPartOfText = new Label("This is some text having a link, ", x, y, firstTextWidth, height, font, fontSize);
x += firstTextWidth;
float linkTextWidth = font.GetTextWidth("Click here ", fontSize);
Label linkText = new Label("Click here", x, y, linkTextWidth, height, font, fontSize, RgbColor.Blue);
linkText.Underline = true;
Link link = new Link(x, y, linkTextWidth, height, goToAction);
x += linkTextWidth;
Label secondPartOfText = new Label(" to navigate to second page", x, y, font.GetTextWidth(" to navigate to second page", fontSize), height, font, fontSize);
Thanks,
ceTe Software Support Team.