HighlightText()
Contents
[
Hide
]TextFrame::HighlightText(System::String, System::Drawing::Color) method
Highlights all matches of the sample text with the specified color.
void Aspose::Slides::TextFrame::HighlightText(System::String text, System::Drawing::Color highlightColor) override
Arguments
Parameter | Type | Description |
---|---|---|
text | System::String | Text sample to highlight. |
highlightColor | System::Drawing::Color | The color to highlight the text. |
TextFrame::HighlightText(System::String, System::Drawing::Color, System::SharedPtr<ITextHighlightingOptions>) method
Highlights all matches of the sample text with the specified color.
void Aspose::Slides::TextFrame::HighlightText(System::String text, System::Drawing::Color highlightColor, System::SharedPtr<ITextHighlightingOptions> options) override
Arguments
Parameter | Type | Description |
---|---|---|
text | System::String | The text to highlight. |
highlightColor | System::Drawing::Color | The color to highlight the text. |
options | System::SharedPtr<ITextHighlightingOptions> | Highlighting options. |
Remarks
- Deprecated
- Use HighlightText(string text, Color highlightColor, ITextSearchOptions options) method instead. The method will be removed after release of version 24.10.
The following sample code shows how to Highlight Text in a TextFrame.
auto presentation = System::MakeObject<Presentation>(u"SomePresentation.pptx");
auto shape = System::ExplicitCast<AutoShape>(presentation->get_Slide(0)->get_Shape(0));
// highlighting all words 'important'
shape->get_TextFrame()->HighlightText(u"title", System::Drawing::Color::get_LightBlue());
auto textHighlightOptions = System::MakeObject<TextHighlightingOptions>();
textHighlightOptions->set_WholeWordsOnly(true);
// highlighting all separate 'the' occurrences
shape->get_TextFrame()->HighlightText(u"to", System::Drawing::Color::get_Violet(), textHighlightOptions);
presentation->Save(u"SomePresentation-out2.pptx", SaveFormat::Pptx);
TextFrame::HighlightText(System::String, System::Drawing::Color, System::SharedPtr<ITextSearchOptions>, System::SharedPtr<IFindResultCallback>) method
Highlights all matches of the sample text with the specified color.
void Aspose::Slides::TextFrame::HighlightText(System::String text, System::Drawing::Color highlightColor, System::SharedPtr<ITextSearchOptions> options, System::SharedPtr<IFindResultCallback> callback) override
Arguments
Parameter | Type | Description |
---|---|---|
text | System::String | The text to highlight. |
highlightColor | System::Drawing::Color | The color to highlight the text. |
options | System::SharedPtr<ITextSearchOptions> | Text search options ITextSearchOptions. |
callback | System::SharedPtr<IFindResultCallback> | The callback object for receiving search results IFindResultCallback. |
Remarks
The following code sample shows how to highlight text in a TextFrame.
auto presentation = System::MakeObject<Presentation>(u"SomePresentation.pptx");
auto shape = System::ExplicitCast<AutoShape>(presentation->get_Slide(0)->get_Shape(0));
// highlighting all words 'important'
shape->get_TextFrame()->HighlightText(u"important", System::Drawing::Color::get_LightBlue());
auto textSearchOptions = System::MakeObject<TextSearchOptions>();
textSearchOptions->set_WholeWordsOnly(true);
// highlighting all separate 'the' occurrences
shape->get_TextFrame()->HighlightText(u"the", System::Drawing::Color::get_Violet(), textSearchOptions, nullptr);
presentation->Save(u"SomePresentation-out2.pptx", SaveFormat::Pptx);
See Also
- Typedef SharedPtr
- Class String
- Class Color
- Class TextFrame
- Class ITextHighlightingOptions
- Class ITextSearchOptions
- Class IFindResultCallback
- Namespace Aspose::Slides
- Library Aspose.Slides