Text with links embedded


I am trying to add text paragraphs with embedded external hyperlinks in it. What is the best way to achieve this?

Should I add a shape(for ex: rectangle) and add it to it or use TextHolder to add text and links?

How do I mention wrap to next line, if the text overflows? Is there anyway I can calculate the length or size of the text before adding it to slide?



You can both use textholder or textframe to add text as an external hyperlink, both are same except you cannot create textholder, it comes with slide layout but you can create as many textframes as you want.

The following C# code snippet adds an external hyperlink

tf.Text = "Click Aspose to open Aspose WebSite";


Link lnk = tf.Links.AddLink();

//set the two properties of link Link.Begin and Link.End and then set URL

lnk.Begin = tf.Text.IndexOf("Aspose");

lnk.End = lnk.Begin + "Aspose".Length;


TextFrame has a property WrapText, in java you can set it using setter function i.e setWrapText.

The following code snippet creates a textframe that will wrap and resize itself as more text will be inserted into it

Aspose.Slides.Rectangle rect = sld.Shapes.AddRectangle(600, 1000, 4700, 1);

rect.LineFormat.ShowLines = false;


TextFrame tf = rect.TextFrame;

//Set its wrap text property true, so it wraps text automatically

tf.WrapText = true;

//Set this propert true, so textframe can chage its shape automatically

tf.FitShapeToText = true;