Find And Replace in Python
Contents
[
Hide
]
Aspose.Words - Find And Replace
To replace text using Aspose.Words Java in Python, simply invoke the replace() method.
Python Code
# The path to the documents directory.
doc = jpype.Jclass("com.aspose.words.Document","ReplaceSimple.doc")
FindReplaceDirection =jpype.JClass("com.aspose.words.FindReplaceDirection")
FindReplaceOptions =jpype.JClass("com.aspose.words.FindReplaceOptions")
doc = Document('data/ReplaceSimple.doc')
# Replace the text in the document.
doc.getRange().replace(_CustomerName_, James Bond, FindReplaceOptions(FindReplaceDirection.FORWARD))
Download Running Code
Download Find And Replace (Aspose.Words) from any of the below mentioned social coding sites: