TextFrame
Properties TextFrame class egy bekezdéseket tartalmazó szövegkeretet képvisel. Megvalósítja ITextFrame.
Properties: org.aspose.slides.foss
import org.aspose.slides.foss.*;public class TextFrame implements ITextFrameTulajdonságok
| Name | Type | Access | Description |
|---|---|---|---|
paragraphs | IParagraphCollection | Read | Returns the paragraph collection. |
textFrameFormat | ITextFrameFormat | Read | Returns the text frame format. |
text | String | Read | Gets the text. |
slide | IBaseSlide | Read | Gets the slide. |
presentation | IPresentation | Read | Gets the presentation. |
parentShape | IShape | Read | Gets the parent shape. |
parentCell | ICell | Read | Gets the parent cell. |
| Signature | Description |
|---|---|
TextFrame(txBodyElement: Element, saveCallback: Runnable) | Creates a TextFrame backed by the given text body element. |
TextFrame(txBodyElement: Element, saveCallback: Runnable, parentSlide: IBaseSlide, parentShape: IShape) | Creates a TextFrame backed by the given text body element with parent context. |
getParagraphs() → IParagraphCollection | Returns the paragraph collection. |
getTextFrameFormat() → ITextFrameFormat | Returns the text frame format. |
getText() → String | Returns the text. |
setText(text: String) | Sets the text value. |
getSlide() → IBaseSlide | Returns the slide. |
getPresentation() → IPresentation | Returns the presentation. |
asIPresentationComponent() → IPresentationComponent | Casts the text frame to an IPresentationComponent |
getParentShape() → IShape | Returns the parent shape. |
getParentCell() → ICell | Returns the parent cell. |
asISlideComponent() → ISlideComponent | Casts the text frame to an ISlideComponent |
Használati példák
Szöveg olvasása és írása
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);Bekezdések kezelése
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());
}