ReplaceText
TextFrame.ReplaceText method
Replaces all occurrences of the specified text with another specified text.
public void ReplaceText(string oldText, string newText, ITextSearchOptions options,
IFindResultCallback callback)
Parameter | Type | Description |
---|---|---|
oldText | String | The string to be replaced. |
newText | String | The string to replace all occurrences of oldText. |
options | ITextSearchOptions | Text search options ITextSearchOptions . |
callback | IFindResultCallback | Callback object for saving replacement operation result IFindResultCallback . |
Examples
The following sample code shows how to replace one speified string with another speified string.
[C#]
using (Presentation presentation = new Presentation("SomePresentation.pptx")){
// Replace all separate 'the' occurrences with '***'
((AutoShape)presentation.Slides[0].Shapes[0]).TextFrame.ReplaceText("the", "***", new TextSearchOptions()
{ WholeWordsOnly = true }, null);
presentation.Save("SomePresentation-out2.pptx", SaveFormat.Pptx);
}
See Also
- interface ITextSearchOptions
- interface IFindResultCallback
- class TextFrame
- namespace Aspose.Slides
- assembly Aspose.Slides