menu

Xamarin.Android

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Interface IParagraph - Xamarin.Android API Reference | Syncfusion

    Show / Hide Table of Contents

    Interface IParagraph

    Represents a paragraph in the shape.

    Namespace: Syncfusion.Presentation
    Assembly: Syncfusion.Presentation.Portable.dll
    Syntax
    public interface IParagraph

    Properties

    EndParagraphFont

    Declaration
    IFont EndParagraphFont { get; }
    Property Value
    Type
    IFont

    FirstLineIndent

    Gets or sets the first line indent of the paragraph, in points.

    Declaration
    double FirstLineIndent { get; set; }
    Property Value
    Type
    System.Double
    Examples
    //Create a new presentation instance.
    IPresentation presentation = Presentation.Create();
    //Add the slide into the presentation
    ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
    // Add a text box to hold the list
    IShape textBoxShape = slide.AddTextBox(65, 140, 410, 270);
    // Add a new paragraph with the text in the left hand side text box.
    IParagraph paragraph = textBoxShape.TextBody.AddParagraph("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
    // Set the hanging value
    paragraph.FirstLineIndent = 20;
    //Save the presentation
    presentation.Save("Sample.pptx");
    //Close the presentation
    presentation.Close();
    'Create a new presentation instance.
    Dim presentation__1 As IPresentation = Presentation.Create()
    'Add the slide into the presentation
    Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
    ' Add a text box to hold the list
    Dim textBoxShape As IShape = slide.AddTextBox(65, 140, 410, 270)
    ' Add a new paragraph with the text in the left hand side text box.
    Dim paragraph As IParagraph = textBoxShape.TextBody.AddParagraph("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
    ' Set the hanging value
    paragraph.FirstLineIndent = 20
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    Font

    Gets an IFont instance of the paragraph. Read-only.

    Declaration
    IFont Font { get; }
    Property Value
    Type
    IFont
    Examples
    //Create a new presentation instance.
    IPresentation presentation = Presentation.Create();
    //Add the slide into the presentation
    ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
    // Add a text box to hold the list
    IShape textBoxShape = slide.AddTextBox(65, 140, 410, 270);
    // Add a new paragraph with the text in the left hand side text box.
    IParagraph paragraph = textBoxShape.TextBody.AddParagraph("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
    //Retrieve the paragraph font
    IFont font = paragraph.Font;
    //Set the font size
    font.FontSize = 26;
    //Save the presentation
    presentation.Save("Sample.pptx");
    //Close the presentation
    presentation.Close();
    'Create a new presentation instance.
    Dim presentation__1 As IPresentation = Presentation.Create()
    'Add the slide into the presentation
    Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
    ' Add a text box to hold the list
    Dim textBoxShape As IShape = slide.AddTextBox(65, 140, 410, 270)
    ' Add a new paragraph with the text in the left hand side text box.
    Dim paragraph As IParagraph = textBoxShape.TextBody.AddParagraph("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
    'Retrieve the paragraph font
    Dim font As IFont = paragraph.Font
    'Set the font size
    font.FontSize = 26
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    HorizontalAlignment

    Gets or sets the horizontal alignment of the paragraph.

    Declaration
    HorizontalAlignmentType HorizontalAlignment { get; set; }
    Property Value
    Type
    HorizontalAlignmentType
    Examples
    //Create a new presentation instance.
    IPresentation presentation = Presentation.Create();
    //Add the slide into the presentation
    ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
    // Add a text box to hold the list
    IShape textBoxShape = slide.AddTextBox(65, 140, 410, 270);
    // Add a new paragraph with the text in the left hand side text box.
    IParagraph paragraph = textBoxShape.TextBody.AddParagraph("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
    //Set the horizontal alignment 
    paragraph.HorizontalAlignment = HorizontalAlignmentType.Justify;
    //Save the presentation
    presentation.Save("Sample.pptx");
    //Close the presentation
    presentation.Close();
    'Create a new presentation instance.
    Dim presentation__1 As IPresentation = Presentation.Create()
    'Add the slide into the presentation
    Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
    ' Add a text box to hold the list
    Dim textBoxShape As IShape = slide.AddTextBox(65, 140, 410, 270)
    ' Add a new paragraph with the text in the left hand side text box.
    Dim paragraph As IParagraph = textBoxShape.TextBody.AddParagraph("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
    'Set the horizontal alignment 
    paragraph.HorizontalAlignment = HorizontalAlignmentType.Justify
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    IndentLevelNumber

    Gets or sets the indent level as an integer from 0 to 8, where 0 indicates a first-level paragraph with no indentation.

    Declaration
    int IndentLevelNumber { get; set; }
    Property Value
    Type
    System.Int32
    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 text box to the slide
    IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 350);
    //Add first paragraph to the text body
    IParagraph paragraph = shape.TextBody.AddParagraph();
    //Add first text part to the paragraph
    paragraph.AddTextPart("First Paragraph, First Textpart");
    //Create instance for text part
    ITextPart textPart = paragraph.AddTextPart();
    //Set text for the text part
    textPart.Text = " First Paragraph, second Textpart";
    //Set the list level as 1
    paragraph.IndentLevelNumber = 1;
    //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 text box to the slide
    Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 350)
    'Add first paragraph to the text body
    Dim paragraph As IParagraph = shape.TextBody.AddParagraph()
    'Add first text part to the paragraph
    paragraph.AddTextPart("First Paragraph, First Textpart")
    'Create instance for text part
    Dim text part As ITextPart = paragraph.AddTextPart()
    'Set text for the text part
    text part.Text = " First Paragraph, second Textpart"
    'Set the list level as 1
    paragraph.IndentLevelNumber = 1
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    LeftIndent

    Gets or sets the left indent of the paragraph, in points.

    Declaration
    double LeftIndent { get; set; }
    Property Value
    Type
    System.Double
    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 text box to the slide
    IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 350);           
    //Add first paragraph to the text body
    IParagraph paragraph = shape.TextBody.AddParagraph();
    //Add first text part to the paragraph
    paragraph.AddTextPart("First Paragraph, First Textpart");
    //Set the left indent 
    paragraph.LeftIndent = 20;
    //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 text box to the slide
    Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 350)
    'Add first paragraph to the text body
    Dim paragraph As IParagraph = shape.TextBody.AddParagraph()
    'Add first text part to the paragraph
    paragraph.AddTextPart("First Paragraph, First Textpart")
    'Set the left indent 
    paragraph.LeftIndent = 20
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    LineSpacing

    Gets or sets the line spacing, in points.

    Declaration
    double LineSpacing { get; set; }
    Property Value
    Type
    System.Double
    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 text box to the slide
    IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 350);           
    //Add first paragraph to the text body
    IParagraph paragraph = shape.TextBody.AddParagraph();
    //Add first text part to the paragraph
    paragraph.AddTextPart("First Paragraph, First Textpart");
    //Set line spacing for paragraph
    paragraph.LineSpacing = 20;
    //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 text box to the slide
    Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 350)
    'Add first paragraph to the text body
    Dim paragraph As IParagraph = shape.TextBody.AddParagraph()
    'Add first text part to the paragraph
    paragraph.AddTextPart("First Paragraph, First Textpart")
    'Set line spacing for paragraph
    paragraph.LineSpacing = 20
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    ListFormat

    Gets an IListFormat instance that represents the list formatting for the specified paragraph. Read-only.

    Declaration
    IListFormat ListFormat { get; }
    Property Value
    Type
    IListFormat
    Examples
    //Create a new presentation instance.
    IPresentation presentation = Presentation.Create();
    //Add the slide into the presentation
    ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
    // Add a text box to hold the list
    IShape textBoxShape = slide.AddTextBox(65, 140, 410, 270);
    // Add a new paragraph with the text in the left hand side text box.
    IParagraph paragraph = textBoxShape.TextBody.AddParagraph("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
    //Get the list format of paragraph, read only
    IListFormat listFormat = paragraph.ListFormat;
    //Set the list type
    listFormat.Type = ListType.Bulleted;
    //Set the character for bullet
    listFormat.BulletCharacter = '♠';
    //Save the presentation
    presentation.Save("Sample.pptx");
    //Close the presentation
    presentation.Close();
    'Create a new presentation instance.
    Dim presentation__1 As IPresentation = Presentation.Create()
    'Add the slide into the presentation
    Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
    ' Add a text box to hold the list
    Dim textBoxShape As IShape = slide.AddTextBox(65, 140, 410, 270)
    ' Add a new paragraph with the text in the left hand side text box.
    Dim paragraph As IParagraph = textBoxShape.TextBody.AddParagraph("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
    'Get the list format of paragraph, read only
    Dim listFormat As IListFormat = paragraph.ListFormat
    'Set the list type
    listFormat.Type = ListType.Bulleted
    'Set the character for bullet
    listFormat.BulletCharacter = "♠"C
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    SpaceAfter

    Gets or sets the amount of space after the last line in each paragraph of the specified text, in points.

    Declaration
    double SpaceAfter { get; set; }
    Property Value
    Type
    System.Double
    Examples
    //Create a new presentation instance.
    IPresentation presentation = Presentation.Create();
    //Add the slide into the presentation
    ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
    // Add a text box to hold the list
    IShape textBoxShape = slide.AddTextBox(65, 140, 410, 270);
    // Add a new paragraph with the text in the left hand side text box.
    IParagraph paragraph1 = textBoxShape.TextBody.AddParagraph("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
    //Add another paragraph.
    IParagraph paragraph2 = textBoxShape.TextBody.AddParagraph("Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.");
    //Set space after 
    paragraph1.SpaceAfter = 30;
    //Save the presentation
    presentation.Save("Sample.pptx");
    //Close the presentation
    presentation.Close();
    'Create a new presentation instance.
    Dim presentation__1 As IPresentation = Presentation.Create()
    'Add the slide into the presentation
    Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
    ' Add a text box to hold the list
    Dim textBoxShape As IShape = slide.AddTextBox(65, 140, 410, 270)
    ' Add a new paragraph with the text in the left hand side text box.
    Dim paragraph1 As IParagraph = textBoxShape.TextBody.AddParagraph("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
    'Add another paragraph.
    Dim paragraph2 As IParagraph = textBoxShape.TextBody.AddParagraph("Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.")
    'Set space after 
    paragraph1.SpaceAfter = 30
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    SpaceBefore

    Gets or sets the amount of space before the first line in each paragraph of the specified text, in points.

    Declaration
    double SpaceBefore { get; set; }
    Property Value
    Type
    System.Double
    Examples
    //Create a new presentation instance.
    IPresentation presentation = Presentation.Create();
    //Add the slide into the presentation
    ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
    // Add a text box to hold the list
    IShape textBoxShape = slide.AddTextBox(65, 140, 410, 270);
    // Add a new paragraph with the text in the left hand side text box.
    IParagraph paragraph = textBoxShape.TextBody.AddParagraph("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
    //Set space before 
    paragraph.SpaceBefore = 10;
    //Save the presentation
    presentation.Save("Sample.pptx");
    //Close the presentation
    presentation.Close();
    'Create a new presentation instance.
    Dim presentation__1 As IPresentation = Presentation.Create()
    'Add the slide into the presentation
    Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
    ' Add a text box to hold the list
    Dim textBoxShape As IShape = slide.AddTextBox(65, 140, 410, 270)
    ' Add a new paragraph with the text in the left hand side text box.
    Dim paragraph As IParagraph = textBoxShape.TextBody.AddParagraph("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
    'Set space before 
    paragraph.SpaceBefore = 10
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    Text

    Gets the text content of the paragraph. Read-only.

    Declaration
    string Text { get; set; }
    Property Value
    Type
    System.String
    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 text box to the slide
    IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 350);
    //Add first paragraph to the text body
    IParagraph paragraph = shape.TextBody.AddParagraph();
    //Add first text part to the paragraph
    paragraph.AddTextPart("First Paragraph, First Textpart");
    //Add text part to the paragraph
    ITextPart textPart = paragraph.AddTextPart();
    //Set text for the text part
    textPart.Text = " First Paragraph, second Textpart";
    //Get the paragraph text, it is read only 
    string entireText = paragraph.Text;
    //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 text box to the slide
    Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 350)
    'Add first paragraph to the text body
    Dim paragraph As IParagraph = shape.TextBody.AddParagraph()
    'Add first text part to the paragraph
    paragraph.AddTextPart("First Paragraph, First Textpart")
    'Add text part to the paragraph
    Dim text part As ITextPart = paragraph.AddTextPart()
    'Set text for the text part
    text part.Text = " First Paragraph, second Textpart"
    'Get the paragraph text, it is read only 
    Dim entireText As String = paragraph.Text
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    TextParts

    Gets the text part collection of ITextParts instance. Read-only.

    Declaration
    ITextParts TextParts { get; }
    Property Value
    Type
    ITextParts
    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 text box to the slide
    IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 350);           
    //Add first paragraph to the text body
    IParagraph paragraph = shape.TextBody.AddParagraph();
    //Add first text part to the paragraph
    paragraph.AddTextPart("First Paragraph, First Textpart");
    //Create instance for text part
    ITextPart textPart = paragraph.AddTextPart();
    //Set text for the text part
    textPart.Text = " First Paragraph, second Textpart";
    //Get the collection of text part in a paragraph, it is read only
    ITextParts textParts = paragraph.TextParts;
    //Set the first text part with bold style
    textParts[0].Font.Bold = true;
    //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 text box to the slide
    Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 350)
    'Add first paragraph to the text body
    Dim paragraph As IParagraph = shape.TextBody.AddParagraph()
    'Add first text part to the paragraph
    paragraph.AddTextPart("First Paragraph, First Textpart")
    'Create instance for text part
    Dim text part As ITextPart = paragraph.AddTextPart()
    'Set text for the text part
    text part.Text = " First Paragraph, second Textpart"
    'Get the collection of text part in a paragraph, it is read only
    Dim text parts As ITextParts = paragraph.TextParts
    'Set the first text part with bold style
    text parts(0).Font.Bold = True
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    Methods

    AddHyperlink(String, String)

    Adds the hyperlink to the textpart with the specified link.

    Declaration
    IHyperLink AddHyperlink(string textToDisplay, string link)
    Parameters
    Type Name Description
    System.String textToDisplay

    The text content to initialize the new ITextPart instance.

    System.String link

    Represents the address of the target document path or web url.

    Returns
    Type Description
    IHyperLink

    Returns an IHyperLink instance.

    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);
    //Add paragraph into the shape
    IParagraph paragraph = shape.TextBody.AddParagraph();
    //Add hyperlink to the TextPart and screen tip to the hyperlink.
    IHyperLink hyperLink = paragraph.AddHyperlink("Google", "https://www.google.com");
    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 slide into 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()
    'Add hyperlink to the TextPart and screen tip to the hyperlink.
    Dim hyperLink As IHyperLink = paragraph.AddHyperlink("Google", "https://www.google.com")
    hyperLink.ScreenTip = "This hyperlink navigates to Google site"
    'Saves the Presentation.
    ppDoc.Save("Sample.pptx")
    'Close the presentation.
    ppDoc.Close()

    AddTextPart()

    Adds a text part to the text part collection.

    Declaration
    ITextPart AddTextPart()
    Returns
    Type Description
    ITextPart

    Returns an ITextPart instance this method creates.

    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 text box to the slide
    IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 350);
    //Add first paragraph to the text body
    IParagraph paragraph = shape.TextBody.AddParagraph();
    //Create instance for text part
    ITextPart textPart = paragraph.AddTextPart();
    //Set text for the text part
    textPart.Text = " First Paragraph, second Textpart";
    //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 text box to the slide
    Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 350)
    'Create instance for text part
    Dim text part As ITextPart = paragraph.AddTextPart()
    'Set text for the text part
    text part.Text = " First Paragraph, second Textpart"
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    AddTextPart(String)

    Adds a text part to the text part collection with the specified text.

    Declaration
    ITextPart AddTextPart(string text)
    Parameters
    Type Name Description
    System.String text

    The text content to initialize the new ITextPart instance.

    Returns
    Type Description
    ITextPart

    Returns an ITextPart instance this method creates.

    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 text box to the slide
    IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 350);
    //Add first paragraph to the text body
    IParagraph paragraph = shape.TextBody.AddParagraph();
    //Add first text part to the paragraph
    paragraph.AddTextPart("First Paragraph, First Textpart");
    //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 text box to the slide
    Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 350)
    'Add first paragraph to the text body
    Dim paragraph As IParagraph = shape.TextBody.AddParagraph()
    'Add first text part to the paragraph
    paragraph.AddTextPart("First Paragraph, First Textpart")
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    Clone()

    Creates an independent copy of IParagraph instance.

    Declaration
    IParagraph Clone()
    Returns
    Type Description
    IParagraph

    Returns the cloned paragraph instance.

    Examples
    //Open an existing presentation.
    IPresentation presentation = Presentation.Open("Presentation.pptx");
    //Retrieve the slide instance.
    ISlide slide = presentation.Slides[0];
    //Add a new text box to the slide.
    IShape textboxShape = slide.AddTextBox(0, 0, 250, 250);
    //Add a paragraph with text content to the shape.
    IParagraph paragraph = textboxShape.TextBody.AddParagraph("Hello Presentation");
    //Create a cloned copy of paragraph.
    IParagraph clonedParagraph = paragraph.Clone();
    clonedParagraph.TextParts[0].Text = "Replaced text";
    //Save the presentation to the file system.
    presentation.Save("Output.pptx");
    //Close the presentation
    presentation.Close();
    'Open an existing presentation.
    Dim presentation__1 As IPresentation = Presentation.Open("Presentation.pptx")
    'Retrieve the slide instance.
    Dim slide As ISlide = presentation__1.Slides(0)
    'Add a new text box to the cloned slide.
    Dim textboxShape As IShape = slide.AddTextBox(0, 0, 250, 250)
    'Add a paragraph with text content to the shape.
    Dim paragraph As IParagraph = textboxShape.TextBody.AddParagraph("Hello Presentation")
    'Create a cloned copy of paragraph.
    Dim clonedParagraph As IParagraph = paragraph.Clone();
    clonedParagraph.TextParts[0].Text = "Replaced Text";
    'Add the slide to the presentation.
    presentation__1.Slides.Add(slideClone)
    'Save the presentation to the file system.
    presentation__1.Save("Output.pptx")
    'Close the presentation
    presentation__1.Close()
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved