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 ITextFrame

Properties

PropertyTypeAccessDescription
getText() / setText(String)StringRead/WritePlain text content of the text frame.
getParagraphs()IParagraphCollectionReadCollection of paragraphs.
getTextFrameFormat()ITextFrameFormatReadText frame formatting properties.
getParentShape()IShapeReadParent shape owning this text frame.
getParentCell()ICellReadParent table cell (if inside a table).
getSlide()IBaseSlideReadParent slide.
getPresentation()IPresentationReadParent 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());
}

See Also