HighlightRegex()
Contents
[
Hide
]TextFrame::HighlightRegex(System::String, System::Drawing::Color, System::SharedPtr<ITextHighlightingOptions>) method
Highlights all matches of the regular expression with the specified color.
void Aspose::Slides::TextFrame::HighlightRegex(System::String regex, System::Drawing::Color highlightColor, System::SharedPtr<ITextHighlightingOptions> options) override
Arguments
Parameter | Type | Description |
---|---|---|
regex | System::String | Text of regular expression to get text to highlight. |
highlightColor | System::Drawing::Color | The color to highlight the text. |
options | System::SharedPtr<ITextHighlightingOptions> | Highlighting options. |
Remarks
- Deprecated
- Use HighlightRegex(Regex regex, Color highlightColor, IFindResultCallback callback) method instead. The method will be removed after release of version 24.10.
The following code sample shows how to highlight text in a TextFrame using a regular expression.
auto presentation = System::MakeObject<Presentation>(u"SomePresentation.pptx");
auto shape = System::ExplicitCast<AutoShape>(presentation->get_Slide(0)->get_Shape(0));
auto options = System::MakeObject<TextHighlightingOptions>();
// highlighting all words with 10 or more characters
shape->get_TextFrame()->HighlightRegex(u"\\b[^\\s]{10,}\\b", System::Drawing::Color::get_Blue(), options);
presentation->Save(u"SomePresentation-out.pptx", SaveFormat::Pptx);
TextFrame::HighlightRegex(System::SharedPtr<System::Text::RegularExpressions::Regex>, System::Drawing::Color, System::SharedPtr<IFindResultCallback>) method
Highlights all matches of the regular expression with the specified color.
void Aspose::Slides::TextFrame::HighlightRegex(System::SharedPtr<System::Text::RegularExpressions::Regex> regex, System::Drawing::Color highlightColor, System::SharedPtr<IFindResultCallback> callback) override
Arguments
Parameter | Type | Description |
---|---|---|
regex | System::SharedPtr<System::Text::RegularExpressions::Regex> | The regular expression System::Text::RegularExpressions::Regex to get strings to highlight. |
highlightColor | System::Drawing::Color | The color to highlight the text. |
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 using a regular expression.
auto presentation = System::MakeObject<Presentation>(u"SomePresentation.pptx");
auto shape = System::ExplicitCast<AutoShape>(presentation->get_Slide(0)->get_Shape(0));
auto regex = System::MakeObject<System::Text::RegularExpressions::Regex>(u"\\b[^\\s]{10,}\\b");
// highlighting all words with 10 or more characters
shape->get_TextFrame()->HighlightRegex(regex, System::Drawing::Color::get_Blue(), nullptr);
presentation->Save(u"SomePresentation-out.pptx", SaveFormat::Pptx);
See Also
- Typedef SharedPtr
- Class String
- Class Color
- Class ITextHighlightingOptions
- Class TextFrame
- Class Regex
- Class IFindResultCallback
- Namespace Aspose::Slides
- Library Aspose.Slides