Here is a quick introduction to how to clear metadata from Word document in Java. It has details for setting the IDE, a list of programming steps, and a runnable sample code for removing metadata from Word in Java. You will learn to remove the properties completely as well as delete the values only along with the options for processing the selected properties only.
Steps to Remove Metadata from Word Document in Java
- Establish the environment to use Aspose.Words for Java to clear the properties
- Load the Word document where built-in and custom properties are present
- Access the custom properties using the getCustomDocumentProperties() method
- Call the clear() method from the CustomDocumentProperties class to remove the properties
- Call the getBuiltInDocumentProperties() method to access the builtin properties
- Call the clear() method to delete the values and save the file
This process explains how to remove all document properties and personal information in Java. For removing the properties completely, call the clear() method in the CustomDocumentProperties class whereas for deleting the values of the permanent properties, call the clear() method.
Code to Clean Metadata from Word Document in Java
This code demonstrates the process to remove all of the document properties and personal information in Java. Different options are available to delete the selected properties using the remove() method by providing the names and calling the same method by providing the respective property indexes. You may also add custom properties using the add() method by providing the property name and the value.
This article has guided us to remove all document properties and personal information in Java. If you want to learn the process to edit the metadata, refer to the article on how to edit Word document metadata in Java.