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, IPresentationComponentConstructors
| Signature | Description |
|---|---|
Paragraph() | Create a new empty paragraph. |
Paragraph(String text) | Create a paragraph with text. |
Properties
| Property | Type | Access | Description |
|---|---|---|---|
getText() / setText(String) | String | Read/Write | Plain text content. |
getPortions() | IPortionCollection | Read | Collection of text portions (runs). |
getParagraphFormat() | IParagraphFormat | Read | Paragraph formatting (alignment, indent, etc.). |
getSlide() | IBaseSlide | Read | Parent slide. |
getPresentation() | IPresentation | Read | Parent 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
- TextFrame
- Portion
- ParagraphCollection (managed through
TextFrame.getParagraphs())