TextFrame — Aspose.Slides FOSS for Java API Reference
The TextFrame class represents a text frame containing paragraphs. It implements ITextFrame.
Package: org.aspose.slides.foss
import org.aspose.slides.foss.*;public class TextFrame implements ITextFrameProperties
| Property | Type | Access | Description |
|---|---|---|---|
getText() / setText(String) | String | Read/Write | Plain text content of the text frame. |
getParagraphs() | IParagraphCollection | Read | Collection of paragraphs. |
getTextFrameFormat() | ITextFrameFormat | Read | Text frame formatting properties. |
getParentShape() | IShape | Read | Parent shape owning this text frame. |
getParentCell() | ICell | Read | Parent table cell (if inside a table). |
getSlide() | IBaseSlide | Read | Parent slide. |
getPresentation() | IPresentation | Read | Parent presentation. |
Usage Examples
Read and Write Text
import org.aspose.slides.foss.*;
Presentation prs = new Presentation("deck.pptx");
ISlide slide = prs.getSlides().get(0);
IAutoShape shape = (IAutoShape) slide.getShapes().get(0);
ITextFrame tf = shape.getTextFrame();
System.out.println("Text: " + tf.getText());
tf.setText("Updated text");
prs.save("updated.pptx", SaveFormat.PPTX);Work with Paragraphs
ITextFrame tf = shape.getTextFrame();
IParagraphCollection paragraphs = tf.getParagraphs();
for (int i = 0; i < paragraphs.size(); i++) {
IParagraph para = paragraphs.get(i);
System.out.println("Paragraph " + i + ": " + para.getText());
}