ReplaceRegex
TextFrame.ReplaceRegex method
Replaces all matches of regular expression with specified string.
public void ReplaceRegex(Regex regex, string newText, IFindResultCallback callback)
Parameter | Type | Description |
---|---|---|
regex | Regex | The regular expression Regex to get strings to be replaced. |
newText | String | The string to replace all occurrences of strings to be replaced. |
callback | IFindResultCallback | Callback object for saving replacement operation result IFindResultCallback . |
Examples
The following sample code shows how to replace text using regular expression with specified string.
[C#]
using (Presentation presentation = new Presentation("SomePresentation.pptx")){
Regex regex = new Regex(@"\b[^\s]{10,}\b");
// Replace all words with 10 or more characters with '***'
((AutoShape)presentation.Slides[0].Shapes[0]).TextFrame.ReplaceRegex(regex, "***", null);
presentation.Save("SomePresentation-out.pptx", SaveFormat.Pptx);
}
See Also
- interface IFindResultCallback
- class TextFrame
- namespace Aspose.Slides
- assembly Aspose.Slides