Interface IHyperLink
Represents a hyperlink associated with a non-placeholder shape or text.
Namespace: Syncfusion.Presentation
Assembly: Syncfusion.Presentation.Base.dll
Syntax
public interface IHyperLink
Properties
Action
Gets the type of action, the hyperlink will be perform when the specified shape or text is clicked. Read-only.
Declaration
HyperLinkType Action { get; }
Property Value
Type | Description |
---|---|
HyperLinkType | The action. |
Examples
//Create a new presentation.
IPresentation ppDoc = Presentation.Create();
//Add a slide to the presentation.
ISlide slide = ppDoc.Slides.Add(SlideLayoutType.Blank);
//Add a rectangle to the slide
IShape shape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 100, 100, 100);
//Adds paragraph into the shape
IParagraph paragraph = shape.TextBody.AddParagraph();
//Adds text to the TextPart
paragraph.Text = "Google";
//Set hyperlink to the TextPart
IHyperLink hyperLink = paragraph.TextParts[0].SetHyperlink("https://www.google.com");
//Set screen tip to the hyperlink
hyperLink.ScreenTip = "This hyperlink navigates to Google site";
//Gets the hyperlink action type.
HyperLinkType actionType = hyperLink.Action;
//Save the presentation
ppDoc.Save("Sample.pptx");
//Close the presentation
ppDoc.Close();
'Create a new presentation.
Dim ppDoc As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = ppDoc.Slides.Add(SlideLayoutType.Blank)
'Add a rectangle to the slide
Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 100, 100, 100)
'Adds paragraph into the shape
Dim paragraph As IParagraph = shape.TextBody.AddParagraph()
'Adds text to the TextPart
paragraph.Text = "Google"
'Set hyperlink to the TextPart
Dim hyperLink As IHyperLink = paragraph.TextParts(0).SetHyperlink("https://www.google.com")
'Set screen tip to the hyperlink
hyperLink.ScreenTip = "This hyperlink navigates to Google site"
'Gets the hyperlink action type.
Dim actionType As HyperLinkType = hyperLink.Action
'Save the presentation
ppDoc.Save("Sample.pptx")
'Close the presentation
ppDoc.Close()
ScreenTip
Gets or sets the screen tip text of a hyperlink.
Declaration
string ScreenTip { get; set; }
Property Value
Type | Description |
---|---|
System.String | The text to be appeared in surface of hyperlink. |
Examples
//Create a new presentation.
IPresentation ppDoc = Presentation.Create();
//Add a slide to the presentation.
ISlide slide = ppDoc.Slides.Add(SlideLayoutType.Blank);
//Add a rectangle to the slide
IShape shape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 100, 100, 100);
//Adds paragraph into the shape
IParagraph paragraph = shape.TextBody.AddParagraph();
//Adds text to the TextPart
paragraph.Text = "Google";
//Set hyperlink to the TextPart
IHyperLink hyperLink = paragraph.TextParts[0].SetHyperlink("https://www.google.com");
//Set screen tip to the hyperlink
hyperLink.ScreenTip = "This hyperlink navigates to Google site";
//Save the presentation
ppDoc.Save("Sample.pptx");
//Close the presentation
ppDoc.Close();
'Create a new presentation.
Dim ppDoc As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = ppDoc.Slides.Add(SlideLayoutType.Blank)
'Add a rectangle to the slide
Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 100, 100, 100)
'Adds paragraph into the shape
Dim paragraph As IParagraph = shape.TextBody.AddParagraph()
'Adds text to the TextPart
paragraph.Text = "Google"
'Set hyperlink to the TextPart
Dim hyperLink As IHyperLink = paragraph.TextParts(0).SetHyperlink("https://www.google.com")
'Set screen tip to the hyperlink
hyperLink.ScreenTip = "This hyperlink navigates to Google site"
'Save the presentation
ppDoc.Save("Sample.pptx")
'Close the presentation
ppDoc.Close()
TargetSlide
Gets the target slide of the hyperlink.
Declaration
ISlide TargetSlide { get; }
Property Value
Type | Description |
---|---|
ISlide | The target slide. |
Examples
//Create a new presentation.
IPresentation presDoc = Presentation.Create();
//Add slides to the presentation.
ISlide slide1 = presDoc.Slides.Add(SlideLayoutType.Blank);
ISlide slide2 = presDoc.Slides.Add();
ISlide slide3 = presDoc.Slides.Add();
ISlide slide4 = presDoc.Slides.Add();
//Add a rectangle shape to the slide.
IShape shape = slide1.Shapes.AddShape(AutoShapeType.Rectangle, 100, 20, 200, 100);
//Sets the hyperlink to the shape.
shape.SetHyperlink("2");
//Gets the target slide of the hyperlink.
ISlide slide = shape.Hyperlink.TargetSlide;
//Save the presentation to the file system.
presDoc.Save("Output.pptx");
//Close the presentation
presDoc.Close();
'Create a new presentation.
Dim presDoc As IPresentation = Presentation.Create()
'Add slides to the presentation.
Dim slide1 As ISlide = presDoc.Slides.Add(SlideLayoutType.Blank)
Dim slide2 As ISlide = presDoc.Slides.Add()
Dim slide3 As ISlide = presDoc.Slides.Add()
Dim slide4 As ISlide = presDoc.Slides.Add()
'Add a rectangle shape to the slide.
Dim shape As IShape = slide1.Shapes.AddShape(AutoShapeType.Rectangle, 100, 20, 200, 100)
'Sets the hyperlink to the shape.
shape.SetHyperlink("2")
'Gets the target slide of the hyperlink.
Dim slide As ISlide = shape.Hyperlink.TargetSlide
'Save the presentation to the file system.
presDoc.Save("Output.pptx")
'Close the presentation
presDoc.Close()
Url
Gets the url address of the hyperlink. Read-only.
Declaration
string Url { get; }
Property Value
Type | Description |
---|---|
System.String | The URL. |
Examples
//Create a new presentation.
IPresentation ppDoc = Presentation.Create();
//Add a slide to the presentation.
ISlide slide = ppDoc.Slides.Add(SlideLayoutType.Blank);
//Add a rectangle to the slide
IShape shape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 100, 100, 100);
//Adds paragraph into the shape
IParagraph paragraph = shape.TextBody.AddParagraph();
//Adds text to the TextPart
paragraph.Text = "Google";
//Set hyperlink to the TextPart
IHyperLink hyperLink = paragraph.TextParts[0].SetHyperlink("https://www.google.com");
//Set screen tip to the hyperlink
hyperLink.ScreenTip = "This hyperlink navigates to Google site";
//Gets the hyperlink action type.
string hyperlinkUrl = hyperLink.Url;
//Save the presentation
ppDoc.Save("Sample.pptx");
//Close the presentation
ppDoc.Close();
'Create a new presentation.
Dim ppDoc As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = ppDoc.Slides.Add(SlideLayoutType.Blank)
'Add a rectangle to the slide
Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 100, 100, 100)
'Adds paragraph into the shape
Dim paragraph As IParagraph = shape.TextBody.AddParagraph()
'Adds text to the TextPart
paragraph.Text = "Google"
'Set hyperlink to the TextPart
Dim hyperLink As IHyperLink = paragraph.TextParts(0).SetHyperlink("https://www.google.com")
'Set screen tip to the hyperlink
hyperLink.ScreenTip = "This hyperlink navigates to Google site"
'Gets the hyperlink Url.
Dim hyperlinkUrl As String = hyperLink.Url
'Save the presentation
ppDoc.Save("Sample.pptx")
'Close the presentation
ppDoc.Close()