Paragraph — Aspose.Slides FOSS for Java API Reference

The Paragraph class represents a text paragraph containing portions (text runs). It implements IParagraph, ISlideComponent, and IPresentationComponent.

Package: org.aspose.slides.foss

import org.aspose.slides.foss.*;
public class Paragraph implements IParagraph, ISlideComponent, IPresentationComponent

Constructors

SignatureDescription
Paragraph()Create a new empty paragraph.
Paragraph(String text)Create a paragraph with text.

Properties

PropertyTypeAccessDescription
getText() / setText(String)StringRead/WritePlain text content.
getPortions()IPortionCollectionReadCollection of text portions (runs).
getParagraphFormat()IParagraphFormatReadParagraph formatting (alignment, indent, etc.).
getSlide()IBaseSlideReadParent slide.
getPresentation()IPresentationReadParent presentation.

Usage Examples

Access Paragraph Portions

import org.aspose.slides.foss.*;

Presentation prs = new Presentation("deck.pptx");
IAutoShape shape = (IAutoShape) prs.getSlides().get(0).getShapes().get(0);
IParagraph para = shape.getTextFrame().getParagraphs().get(0);

for (int i = 0; i < para.getPortions().size(); i++) {
    IPortion portion = para.getPortions().get(i);
    System.out.println("Portion: " + portion.getText());
}

Set Paragraph Text

IParagraph para = shape.getTextFrame().getParagraphs().get(0);
para.setText("New paragraph text");

See Also