ReplaceText
TextFrame.ReplaceText méthode
Remplace toutes les occurrences du texte spécifié par un autre texte spécifié.
public void ReplaceText(string oldText, string newText, ITextSearchOptions options,
IFindResultCallback callback)
Paramètre | Type | Description |
---|---|---|
oldText | String | La chaîne à remplacer. |
newText | String | La chaîne pour remplacer toutes les occurrences de oldText. |
options | ITextSearchOptions | Options de recherche de texte ITextSearchOptions . |
callback | IFindResultCallback | Objet de rappel pour enregistrer le résultat de l’opération de remplacement IFindResultCallback . |
Exemples
Le code d’exemple suivant montre comment remplacer une chaîne spécifiée par une autre chaîne spécifiée.
[C#]
using (Presentation presentation = new Presentation("SomePresentation.pptx")){
// Remplacer toutes les occurrences séparées de 'the' par '***'
((AutoShape)presentation.Slides[0].Shapes[0]).TextFrame.ReplaceText("the", "***", new TextSearchOptions()
{ WholeWordsOnly = true }, null);
presentation.Save("SomePresentation-out2.pptx", SaveFormat.Pptx);
}
Voir Aussi
- interface ITextSearchOptions
- interface IFindResultCallback
- class TextFrame
- namespace Aspose.Slides
- assembly Aspose.Slides