TextFrame

TextFrame

Properties TextFrame class edustaa tekstikehystä, joka sisältää kappaleita. Se toteuttaa ITextFrame.

Properties: org.aspose.slides.foss

import org.aspose.slides.foss.*;
public class TextFrame implements ITextFrame

Properties

NameTypeAccessDescription
paragraphsIParagraphCollectionReadReturns the paragraph collection.
textFrameFormatITextFrameFormatReadReturns the text frame format.
textStringReadGets the text.
slideIBaseSlideReadGets the slide.
presentationIPresentationReadGets the presentation.
parentShapeIShapeReadGets the parent shape.
parentCellICellReadGets the parent cell.
SignatureDescription
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()IParagraphCollectionReturns the paragraph collection.
getTextFrameFormat()ITextFrameFormatReturns the text frame format.
getText()StringReturns the text.
setText(text: String)Sets the text value.
getSlide()IBaseSlideReturns the slide.
getPresentation()IPresentationReturns the presentation.
asIPresentationComponent()IPresentationComponentCasts the text frame to an IPresentationComponent
getParentShape()IShapeReturns the parent shape.
getParentCell()ICellReturns the parent cell.
asISlideComponent()ISlideComponentCasts the text frame to an ISlideComponent

Käyttöesimerkit

Lue ja kirjoita teksti

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);

Työskentele kappaleiden kanssa

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());
}

Katso myös

 Suomi