File Formats

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Interface IShape

    Show / Hide Table of Contents

    Interface IShape

    Represents an object in the drawing layer, such as an AutoShape, text box or picture.

    Inherited Members
    ISlideItem.Clone()
    ISlideItem.Description
    ISlideItem.SlideItemType
    ISlideItem.Height
    ISlideItem.Hidden
    ISlideItem.Left
    ISlideItem.LineFormat
    ISlideItem.ShapeName
    ISlideItem.Title
    ISlideItem.Top
    ISlideItem.Width
    Namespace: Syncfusion.Presentation
    Assembly: Syncfusion.Presentation.Base.dll
    Syntax
    public interface IShape : ISlideItem

    Properties

    AutoShapeType

    Gets the type of the AutoShape instance. Read-only.

    Declaration
    AutoShapeType AutoShapeType { get; }
    Property Value
    Type Description
    AutoShapeType
    Examples
    //Create a new presentation.
    IPresentation presentation = Presentation.Create();
    //Add a blank slide to the presentation.
    ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
    //Add a rectangle to the slide
    IShape shape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 100, 100, 100);
    //Retrieve the autoShape 
    AutoShapeType autoShape = shape.AutoShapeType;
    //Save the presentation
    presentation.Save("Sample.pptx");
    //Close the presentation
    presentation.Close();
    'Create a new presentation.
    Dim presentation__1 As IPresentation = Presentation.Create()
    'Add a blank slide to the presentation.
    Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
    'Add a rectangle to the slide
    Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 100, 100, 100)
    'Retrieve the autoShape 
    Dim autoShape As AutoShapeType = shape.AutoShapeType
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    ConnectionSiteCount

    Gets the connection site count of the shape. Read-only.

    Declaration
    int ConnectionSiteCount { get; }
    Property Value
    Type Description
    System.Int32
    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);
    //Get the connection site count of the shape
    int connectionSiteCount = shape.ConnectionSiteCount;
    // Save the presentation file
    ppDoc.Save("Sample.pptx");
    // Close the presentation file
    ppDoc.Close();
    ' Create a new presentation.
    Dim ppDoc As IPresentation = Presentation.Create()
    ' Add a 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)
    'Get the connection site count of the shape
    Dim connectionSiteCount As int = shape.ConnectionSiteCount;
    ' Save the presentation file
    ppDoc.Save("Sample.pptx")
    ' Close the presentation file
    ppDoc.Close

    Fill

    Gets an IFill instance that represents the fill formatting options of the shape. Read-only.

    Declaration
    IFill Fill { get; }
    Property Value
    Type Description
    IFill
    Examples
    //Create a new presentation.
    IPresentation presentation = Presentation.Create();
    //Add a blank slide to the presentation.
    ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
    //Add a rectangle to the slide
    IShape shape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 100, 100, 100);
    //Set solid fill as fill type for the shape
    shape.Fill.FillType = FillType.Solid;
    //Set the solid fill color
    shape.Fill.SolidFill.Color = ColorObject.Lime;
    //Save the presentation
    presentation.Save("FillShape.pptx");
    //Close the presentation
    presentation.Close();
    'Create a new presentation.
    Dim presentation__1 As IPresentation = Presentation.Create()
    'Add a blank slide to the presentation.
    Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
    'Add a rectangle to the slide
    Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 100, 100, 100)
    'Set solid fill as fill type for the shape
    shape.Fill.FillType = FillType.Solid
    'Set the solid fill color
    shape.Fill.SolidFill.Color = ColorObject.Lime
    'Save the presentation
    presentation__1.Save("FillShape.pptx")
    'Close the presentation
    presentation__1.Close()

    Hyperlink

    Returns an IHyperLink instance that represents the hyperlink for the specified shape.

    Declaration
    IHyperLink Hyperlink { get; }
    Property Value
    Type Description
    IHyperLink
    Examples
    //Load a PowerPoint presentation
    IPresentation presentation = Presentation.Open("Sample.pptx");
    //Get the first slide from the presentation
    ISlide slide = presentation.Slides[0];
    //Get the shape which have the hyperlink
    IShape shape = (IShape)slide.Shapes[0];
    //Get the hyperlink from the shape
    IHyperLink hyperLink = shape.Hyperlink;
    //Get the action type of the hyperlink
    HyperLinkType hypelinkType = hyperLink.Action;
    //Get the target slide of the hyperlink
    ISlide targetSlide = hyperLink.TargetSlide;
    //Get the url of the hyperlink
    string url = hyperLink.Url;
    //Save the presentation
    presentation.Save("Hyperlink.pptx");
    //Close the Presentation
    presentation.Close();
     'Load a PowerPoint presentation
     Dim presentation__1 As IPresentation = Presentation.Open("Sample.pptx")
     'Get the first slide from the presentation
     Dim slide As ISlide = presentation__1.Slides(0)
     'Get the shape which have the hyperlink
     Dim shape As IShape = DirectCast(slide.Shapes(0), IShape)
     'Get the hyperlink from the shape
     Dim hyperLink As IHyperLink = shape.Hyperlink
     'Get the action type of the hyperlink
     Dim hypelinkType As HyperLinkType = hyperLink.Action
     'Get the target slide of the hyperlink
     Dim targetSlide As ISlide = hyperLink.TargetSlide
     'Get the url of the hyperlink
     Dim url As String = hyperLink.Url
     'Save the presentation
     presentation__1.Save("Hyperlink.pptx")
     'Close the Presentation
     presentation__1.Close()

    PlaceholderFormat

    Gets an IPlaceholderFormat object that contains the properties that are unique to placeholders.

    Declaration
    IPlaceholderFormat PlaceholderFormat { get; }
    Property Value
    Type Description
    IPlaceholderFormat
    Examples
    //Create a new presentation.
    IPresentation presentation = Presentation.Create();
    //Add a blank slide to the presentation.
    ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
    //Add a rectangle to the slide
    IShape shape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 100, 100, 100);
    //Retrieve the place holder
    IPlaceholderFormat placeHolder = shape.PlaceholderFormat;
    //Set the name of the place holder
    placeHolder.Name = "My Placeholder";
    //Save the presentation
    presentation.Save("Sample.pptx");
    //Close the presentation
    presentation.Close();
    'Create a new presentation.
    Dim presentation__1 As IPresentation = Presentation.Create()
    'Add a blank slide to the presentation.
    Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
    'Add a rectangle to the slide
    Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 100, 100, 100)
    'Retrieve the place holder
    Dim placeHolder As IPlaceholderFormat = shape.PlaceholderFormat
    'Set the name of the place holder
    placeHolder.Name = "My Placeholder"
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    Rotation

    Gets or sets the number of degrees the specified shape is rotated.

    Declaration
    int Rotation { get; set; }
    Property Value
    Type Description
    System.Int32

    The rotation angle of the shape.

    Remarks

    The rotation value ranges from -3600 degrees to 3600 degrees.

    Examples
    //Create a new presentation.
    IPresentation presentation = Presentation.Create();
    //Add a blank slide to the presentation.
    ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
    //Add a rectangle to the slide
    IShape shape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 100, 100, 100);
    //Set the rotation value to the shape instance.
    shape.Rotation = 300;
    //Save the presentation
    presentation.Save("Sample.pptx");
    //Close the presentation
    presentation.Close();
    'Create a new presentation.
    Dim presentation__1 As IPresentation = Presentation.Create()
    'Add a blank slide to the presentation.
    Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
    'Add a rectangle to the slide
    Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 100, 100, 100)
    'Set the rotation value to the shape instance.
    shape.Rotation = 300
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    TextBody

    Gets an ITextBody instance that represents the text in the shape. Read-only.

    Declaration
    ITextBody TextBody { get; }
    Property Value
    Type Description
    ITextBody
    Examples
    //Create a new presentation
    IPresentation presentation = Presentation.Create();
    //Add a blank slide to the presentation
    ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
    //Add a rectangle to the slide
    IShape shape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 100, 100, 100);
    //Create instance for shape's textBody
    ITextBody textBody = shape.TextBody;
    //Add text to text body
    textBody.Paragraphs.Add().AddTextPart("Hello World");
    //Save the presentation
    presentation.Save("Sample.pptx");
    //Close the presentation
    presentation.Close();        
    'Create a new presentation
    Dim presentation__1 As IPresentation = Presentation.Create()
    'Add a blank slide to the presentation
    Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
    'Add a rectangle to the slide
    Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 100, 100, 100)
    'Create instance for shape's textBody
    Dim textBody As ITextBody = shape.TextBody
    'Add text to text body
    textBody.Paragraphs.Add().AddTextPart("Hello World")
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    Methods

    RemoveHyperlink()

    Declaration
    void RemoveHyperlink()

    SetHyperlink(String)

    Sets the hyperlink to the shape.

    Declaration
    IHyperLink SetHyperlink(string url)
    Parameters
    Type Name Description
    System.String url

    Represents the address of the target hyperlink

    Returns
    Type Description
    IHyperLink

    Returns an IHyperLink instance.

    Remarks

    The target can be a document path, web url, target slide index (index is valid from 0 to slides count – 1) or an email_id.

    Examples
    //Create a new PowerPoint presentation
     IPresentation presentation = Presentation.Create();
     //Add a blank slide to the presentation
     ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
     //Add a rectangle to the slide
     IShape shape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 0, 0, 100, 100);
     //Set the hypelink to the rectangle
     shape.SetHyperlink("www.syncfusion.com");
     //Save the presentation
     presentation.Save("Hyperlink.pptx");
     //Close the Presentation
     presentation.Close();
    'Create a new PowerPoint presentation
    Dim presentation__1 As IPresentation = Presentation.Create()
    'Add a blank slide to the presentation
    Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
    'Add a rectangle to the slide
    Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 0, 0, 100, 100)
    'Set the hypelink to the rectangle
    shape.SetHyperlink("www.syncfusion.com")
    'Save the presentation
    presentation__1.Save("Hyperlink.pptx")
    'Close the Presentation
    presentation__1.Close()
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved