TextFrame

TextFrame

Properties TextFrame class rappresenta un frame di testo contenente paragrafi. Implementa ITextFrame.

Properties: org.aspose.slides.foss

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

Proprietà

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

Esempi di utilizzo

Leggere e scrivere testo

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

Lavorare con i paragrafi

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

Vedi anche

 Italiano