Add Hyperlink to a Shape

Hello,

how can I add an Hyperlink to a Shape?

regards
Chris

Hi Chris,

Thanks for your inquiry. Please try the following source code below:

//load diagram

Diagram diagram = new Diagram("sample.vdx");


//initialize Hyperlink oobject

Hyperlink hyperlink = new Hyperlink();

//set address value

hyperlink.Address.Value = "http://www.google.com/";

//set sub address value

hyperlink.SubAddress.Value = "Sub address here";

//set description value

hyperlink.Description.Value = "Description here";

//set name

hyperlink.Name = "MyHyperLink";


//add hyperlink to the shape

diagram.Pages[0].Shapes[0].Hyperlinks.Add(hyperlink);

//save to local space

diagram.Save("Output.vdx", SaveFileFormat.VDX);

I hope it helps. Please do let me know in case of further assistance or questions.