TextFrame
Inheritance: java.lang.Object
All Implemented Interfaces: com.aspose.slides.ITextFrame, com.aspose.slides.IDOMObject
public final class TextFrame implements ITextFrame, IDOMObject
Represents a TextFrame.
Methods
Method | Description |
---|---|
getParent_Immediate() | |
getParagraphs() | Returns the list of all paragraphs in a frame. |
getText() | Gets or sets the plain text for a TextFrame. |
setText(String value) | Gets or sets the plain text for a TextFrame. |
getTextFrameFormat() | Returns the formatting object for this TextFrame object. |
getHyperlinkQueries() | Provides easy access to contained hyperlinks. |
joinPortionsWithSameFormatting() | Joins runs with same formatting in all paragraphs. |
highlightText(String text, Integer highlightColor) | Highlight all matches of sample in text frame text using specified color. |
highlightText(String text, Integer highlightColor, ITextHighlightingOptions options) | Highlight all matches of sample in text frame text using specified color. |
highlightRegex(String regex, Integer highlightColor, ITextHighlightingOptions options) | Highlight all matches of regular expression in text frame text using specified color. |
getSlide() | Returns the parent slide of a TextFrame. |
getPresentation() | Returns the parent presentation of a TextFrame. |
getParent_Immediate()
public final IDOMObject getParent_Immediate()
Returns Parent_Immediate object. Read-only IDOMObject.
Returns: com.aspose.slides.IDOMObject
getParagraphs()
public final IParagraphCollection getParagraphs()
Returns the list of all paragraphs in a frame. Read-only IParagraphCollection.
Returns: IParagraphCollection
getText()
public final String getText()
Gets or sets the plain text for a TextFrame. Read/write String.
Value: The text.
Returns: java.lang.String
setText(String value)
public final void setText(String value)
Gets or sets the plain text for a TextFrame. Read/write String.
Value: The text.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.lang.String |
getTextFrameFormat()
public final ITextFrameFormat getTextFrameFormat()
Returns the formatting object for this TextFrame object. Read-only ITextFrameFormat.
Returns: ITextFrameFormat
getHyperlinkQueries()
public final IHyperlinkQueries getHyperlinkQueries()
Provides easy access to contained hyperlinks. Read-only IHyperlinkQueries.
Returns: IHyperlinkQueries
joinPortionsWithSameFormatting()
public final void joinPortionsWithSameFormatting()
Joins runs with same formatting in all paragraphs.
highlightText(String text, Integer highlightColor)
public final void highlightText(String text, Integer highlightColor)
Highlight all matches of sample in text frame text using specified color.
Parameters:
Parameter | Type | Description |
---|---|---|
text | java.lang.String | Text sample to highlight. |
highlightColor | java.lang.Integer | Highlighting color. |
highlightText(String text, Integer highlightColor, ITextHighlightingOptions options)
public final void highlightText(String text, Integer highlightColor, ITextHighlightingOptions options)
Highlight all matches of sample in text frame text using specified color.
The following sample code shows how to Highlight Text in a PowerPoint Presentation. try { TextHighlightingOptions textHighlightingOptions = new TextHighlightingOptions(); textHighlightingOptions.setWholeWordsOnly(true); // highlighting all words 'important' ((AutoShape)pres.getSlides().get_Item(0).getShapes().get_Item(0)).getTextFrame().highlightText("title", Color.BLUE); // highlighting all separate 'the' occurrences ((AutoShape)pres.getSlides().get_Item(0).getShapes().get_Item(0)).getTextFrame().highlightText("to", Color.MAGENTA, textHighlightingOptions); pres.save("SomePresentation-out2.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
Parameters:
Parameter | Type | Description |
---|---|---|
text | java.lang.String | Text sample to highlight. |
highlightColor | java.lang.Integer | Highlighting color. |
options | ITextHighlightingOptions | Highlighting options. |
highlightRegex(String regex, Integer highlightColor, ITextHighlightingOptions options)
public final void highlightRegex(String regex, Integer highlightColor, ITextHighlightingOptions options)
Highlight all matches of regular expression in text frame text using specified color.
The following sample code shows how to Highlight Text using regular expression in a PowerPoint Presentation. Presentation pres = new Presentation("SomePresentation.pptx"); try { TextHighlightingOptions options = new TextHighlightingOptions(); // highlighting all words with 10 symbols or longer ((AutoShape) pres.getSlides().get_Item(0).getShapes().get_Item(0)).getTextFrame().highlightRegex("\\b[^\\s){5,}\\b", Color.BLUE, options); pres.save("SomePresentation-out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
Parameters:
Parameter | Type | Description |
---|---|---|
regex | java.lang.String | Text of regular expression to get text to highlight. |
highlightColor | java.lang.Integer | Highlighting color. |
options | ITextHighlightingOptions | Highlighting options. |
getSlide()
public final IBaseSlide getSlide()
Returns the parent slide of a TextFrame. Read-only IBaseSlide.
Returns: IBaseSlide
getPresentation()
public final IPresentation getPresentation()
Returns the parent presentation of a TextFrame. Read-only IPresentation.
Returns: IPresentation