Search Results for

    Show / Hide Table of Contents

    Class Paragraph

    Inheritance
    System.Object
    ContentElement
    ParentElement
    Paragraph
    Implements
    ICloneableElement
    IParentElement
    ITextContainer
    IHasTextStyle
    IParagraph
    IContentElement
    IHasParagraphStyle
    Inherited Members
    ParentElement.InsertChildToIndex(Int32, IContentElement[])
    ParentElement.Remove()
    ParentElement.RemoveChildren(IContentElement[])
    ParentElement.RemoveAllChildren()
    ParentElement.ExtractElements<T>()
    ParentElement.GetChildByIndex<T>(Int32)
    ParentElement.CloneElement<T>(T)
    ParentElement.LogObjectTree()
    ParentElement.Children
    ContentElement._Index
    ContentElement.Replace(IContentElement)
    ContentElement.GetIndex()
    ContentElement.CloneObject<T>(T)
    ContentElement.CaptureInitialValues()
    ContentElement.Index
    ContentElement.Parent
    ContentElement.Status
    Namespace: IronPPT.Models
    Assembly: IronPPT.dll
    Syntax
    public class Paragraph : ParentElement, ICloneableElement, IParentElement, ITextContainer, IHasTextStyle, IParagraph, IContentElement, IHasParagraphStyle

    Adding a block of text to a slide in C# runs through Paragraph. It represents one paragraph of content, the unit a developer builds up with text and then drops onto a slide, and it is what holds the words, their alignment, and their styling together as a single addable element. A Paragraph is the everyday building block behind any slide that carries written content, distinct from a Run, which groups inline content inside richer text.

    Create a paragraph with new Paragraph(), or pass content straight to the constructor that takes params IContentElement[]. Fill it by calling AddText with a string or an IText, then attach it to a slide with Slides[index].AddParagraph(paragraph) on a PresentationDocument. That places the paragraph in the render order of the slide, so the sequence of AddParagraph calls is the sequence the reader sees.

    Styling is set through the Style property, an IParagraphStyle, which controls bullets, spacing, indentation, and line spacing for the whole paragraph, while TextStyle carries the default ITextStyle for its text. Alignment sets the horizontal TextAlignment, and SetAlignment and SetStyle offer the same in a chainable form that returns the paragraph. Texts exposes the contained IText items for inspection, AddChild appends content elements, and Clone copies the whole paragraph when a slide needs a repeated block.

    using IronPPT;
    using IronPPT.Models;
    
    var document = new PresentationDocument();
    var paragraph = new Paragraph();
    paragraph.AddText("First paragraph.");
    document.Slides[0].AddParagraph(paragraph);
    document.Save("paragraph.pptx");

    The add paragraph example builds and places one, the paragraph style example applies styling, and the add text how-to walks through text on a slide.

    Constructors

    Paragraph()

    Declaration
    public Paragraph()

    Paragraph(IContentElement[])

    Declaration
    public Paragraph(params IContentElement[] children)
    Parameters
    Type Name Description
    IContentElement[] children

    Properties

    Alignment

    Declaration
    public TextAlignment Alignment { get; set; }
    Property Value
    Type Description
    TextAlignment

    Style

    Declaration
    public IParagraphStyle Style { get; set; }
    Property Value
    Type Description
    IParagraphStyle

    Texts

    Declaration
    public List<IText> Texts { get; }
    Property Value
    Type Description
    System.Collections.Generic.List<IText>

    TextStyle

    Declaration
    public ITextStyle TextStyle { get; set; }
    Property Value
    Type Description
    ITextStyle

    Methods

    AddChild(IContentElement[])

    Declaration
    public override void AddChild(params IContentElement[] children)
    Parameters
    Type Name Description
    IContentElement[] children
    Overrides
    ParentElement.AddChild(IContentElement[])

    AddText(IText)

    Declaration
    public IText AddText(IText text)
    Parameters
    Type Name Description
    IText text
    Returns
    Type Description
    IText

    AddText(String)

    Declaration
    public IText AddText(string text)
    Parameters
    Type Name Description
    System.String text
    Returns
    Type Description
    IText

    Clone()

    Declaration
    public override IContentElement Clone()
    Returns
    Type Description
    IContentElement
    Overrides
    ParentElement.Clone()

    SetAlignment(TextAlignment)

    Declaration
    public IParagraph SetAlignment(TextAlignment alignment)
    Parameters
    Type Name Description
    TextAlignment alignment
    Returns
    Type Description
    IParagraph

    SetStyle(IParagraphStyle)

    Declaration
    public IParagraph SetStyle(IParagraphStyle style)
    Parameters
    Type Name Description
    IParagraphStyle style
    Returns
    Type Description
    IParagraph

    Implements

    ICloneableElement
    IParentElement
    ITextContainer
    IHasTextStyle
    IParagraph
    IContentElement
    IHasParagraphStyle

    Inherited members

    InsertChildToIndex(Int32, IContentElement[])
    Remove()
    RemoveChildren(IContentElement[])
    RemoveAllChildren()
    ExtractElements<T>()
    GetChildByIndex<T>(Int32)
    CloneElement<T>(T)
    LogObjectTree()
    Children
    _Index
    Replace(IContentElement)
    GetIndex()
    CloneObject<T>(T)
    CaptureInitialValues()
    Index
    Parent
    Status
    ☀
    ☾
    Downloads
    • Download with NuGet
    • Start for Free
    In This Article
    Back to top
    Install with NuGet