Remove Field in Jython
Contents
[
Hide
]
Aspose.Words - Remove Field
To Remove Field using Aspose.Words Java for Jython. Here you can see sample code.
Jython Code
from aspose-words import Settings
from com.aspose.words import Document
class RemoveField:
def __init__(self):
dataDir = Settings.dataDir + 'programming_documents/'
doc = Document(dataDir + "RemoveField.doc")
field = doc.getRange().getFields().get(0)
# Calling this method completely removes the field from the document.
field.remove()
doc.save(dataDir + "RemoveField Out.docx")
print "Field removed from the document successfully."
if __name__ == '__main__':
RemoveField()
Download Running Code
Download running code from any of the below mentioned social coding sites: