HighlightRegex
TextFrame.HighlightRegex method
Highlights all matches of the regular expression with the specified color.
public void HighlightRegex(Regex regex, Color highlightColor, IFindResultCallback callback)
Parameter | Type | Description |
---|---|---|
regex | Regex | The regular expression Regex to get strings to highlight. |
highlightColor | Color | The color to highlight the text. |
callback | IFindResultCallback | The callback object for receiving search results IFindResultCallback . |
Examples
The following code sample shows how to highlight text in a TextFrame using a regular expression.
[C#]
using (Presentation presentation = new Presentation("SomePresentation.pptx"))
{
Regex regex = new Regex(@"\b[^\s]{10,}\b");
// highlighting all words with 10 or more characters
((AutoShape)presentation.Slides[0].Shapes[0]).TextFrame.HighlightRegex(regex, Color.Blue, null);
presentation.Save("SomePresentation-out.pptx", SaveFormat.Pptx);
}
See Also
- interface IFindResultCallback
- class TextFrame
- namespace Aspose.Slides
- assembly Aspose.Slides