Remove Author, Title, and Custom Properties When Converting Office Files in Java
Companion sample repository (pending publication): remove-office-properties-java
Office metadata removal is a GroupDocs.Conversion workflow for Java that clears source document properties while exporting Office files. It addresses a small but easy-to-miss part of document delivery: the file can look ready while its author, title or internal reference still describes a draft. This article follows a Word report through that decision, then applies the same policy to Excel and PowerPoint. The code is pinned to version 26.10 and uses fictional input files.
Introduction
Suppose a report is leaving an internal review process. The visible heading is correct, the figures are approved and the PDF opens normally. None of those checks tells you what its Author field contains. A workbook or presentation can also carry a custom property that makes sense inside a team but adds nothing to the external deliverable. Treat that information as an export decision rather than a surprise discovered by the recipient.
The sample produces two versions of each report. One retains the source properties; the other requests removal of built-in and custom properties. It also writes a same-format Office copy for each run so the checked values can be inspected independently. This is a deliberately observable example. We want evidence that the settings changed the output, not an assumption based on how the first page looks.
Why property cleanup matters at export time
The export step is where a source document becomes a delivery artifact. That makes it a useful place to decide whether internal properties should travel with the content. GroupDocs.Conversion for Java 26.10 exposes separate controls for built-in and custom document properties. You can apply them while loading an Office source, before saving the PDF. The example enables both categories for the external-copy variant.
This is not a substitute for reviewing the document itself. An author name might also appear in a paragraph, a cell, a note or an embedded file. Those locations need separate handling. I would describe the feature as property cleanup in an export pipeline, because that wording matches what the code actually proves. It also avoids promising a broader privacy result than the test covers.
When should I clear Office properties?
Clear source properties when your delivery policy excludes internal authorship, draft titles or custom reference fields from the exported report. Configure the load options before constructing Converter, and compare retained and cleaned outputs using known markers. The example covers DOCX, XLSX and PPTX sources. Review visible content separately, and allow for output-generated PDF fields such as Producer to remain after cleanup.
Prerequisites
The complete project uses JDK 11, Maven and GroupDocs.Conversion for Java 26.10. Its documents directory contains three fictional reports. A license that covers this release is needed for unrestricted verification; evaluation limits can prevent the full comparison from finishing. The code keeps license setup outside the feature methods and uses a placeholder in the distributed source. Do not put a license file in the project.
Installation
The project’s pom.xml declares the GroupDocs Java repository and the dependency shown below. Run the Maven command from that project directory. This article’s Java blocks are method bodies from the verified sample; they assume the relevant imports, an existing Result directory and a boolean parameter named clear.
<dependency>
<groupId>com.groupdocs</groupId>
<artifactId>groupdocs-conversion</artifactId>
<version>26.10</version>
</dependency>
mvn compile exec:java
Step 1: Make the property policy explicit
The three methods receive the same boolean policy. Passing false retains the source settings for a control run; passing true requests removal of both categories. In WordProcessingLoadOptions, the methods are setClearBuiltInDocumentProperties and setClearCustomDocumentProperties. SpreadsheetLoadOptions and PresentationLoadOptions expose the corresponding controls. The consistency lets you review one policy across three distinct input families without hiding which loader opens each file.
The retained-property run matters. If the source marker never reaches an ordinary output, an empty clean output is weak evidence. The demonstration therefore checks for each marker in the retained Office copy and checks its absence in the cleaned copy. That gives the comparison a positive control. Keep a similar test when you introduce a new document template or change the dependency version.
Step 2: Export the Word report
The Word path starts with documents/report.docx. It has fictional document properties and a short visible report. convertWord creates typed options, assigns the policy and supplies those options through the Converter constructor. The method writes a PDF for delivery and a DOCX copy for property inspection. Both are new output files; the source is not rewritten by this sample.
WordProcessingLoadOptions options = new WordProcessingLoadOptions();
options.setClearBuiltInDocumentProperties(clear);
options.setClearCustomDocumentProperties(clear);
String target = "Result/docx-" + (clear ? "clean" : "retained");
try (Converter converter = new Converter("documents/report.docx", () -> options)) {
converter.convert(target + ".pdf", new PdfConvertOptions());
converter.convert(target + ".docx", new WordProcessingConvertOptions());
}
The target name ends in retained or clean, based on the boolean argument. That distinction prevents the two runs from overwriting each other. It also makes manual review easier: open the PDF to inspect presentation and inspect the corresponding Office control to check property storage. In the verified run, Author and Title remained in the retained PDF and disappeared from the cleaned PDF. Producer information remained, which is a separate output-generated field.
Step 3: Apply the policy to Excel and PowerPoint
For an Excel report, use SpreadsheetLoadOptions rather than reusing the Word loader. The conversion code keeps the same property flags and changes the input family and same-format control options. The included XLSX has deliberate blank spacing, so its pagination is not part of the metadata assertion. Check the PDF pages as well as the property result when adapting it to a business report. Property success does not establish that a wide sheet prints as intended.
SpreadsheetLoadOptions options = new SpreadsheetLoadOptions();
options.setClearBuiltInDocumentProperties(clear);
options.setClearCustomDocumentProperties(clear);
String target = "Result/xlsx-" + (clear ? "clean" : "retained");
try (Converter converter = new Converter("documents/report.xlsx", () -> options)) {
converter.convert(target + ".pdf", new PdfConvertOptions());
converter.convert(target + ".xlsx", new SpreadsheetConvertOptions());
}
PowerPoint follows the same loading policy with PresentationLoadOptions. The sample slide contains fictional report text, while its author, title and custom reference live in the document property parts. The method saves PDF plus PPTX so the property comparison remains independent of slide rendering. It does not inspect speaker notes or embedded objects. If those matter to your delivery process, include them in a separate review before release.
PresentationLoadOptions options = new PresentationLoadOptions();
options.setClearBuiltInDocumentProperties(clear);
options.setClearCustomDocumentProperties(clear);
String target = "Result/pptx-" + (clear ? "clean" : "retained");
try (Converter converter = new Converter("documents/report.pptx", () -> options)) {
converter.convert(target + ".pdf", new PdfConvertOptions());
converter.convert(target + ".pptx", new PresentationConvertOptions());
}
Step 4: Verify the result instead of guessing
PropertyChecks inspects the property parts of the six Office control files. It searches for Internal Review Team, Quarterly Review Draft and INTERNAL-REF-2610. Retained copies must contain those known values, and clean copies must omit them. The application prints a PASS line for each checked file and fails if a comparison does not match that expectation. This check is tied to the fictional fixtures, not an assertion that arbitrary metadata was discovered and classified.
We also inspected PDF Author and Title with Poppler pdfinfo. Both fields disappeared in the cleaned exports from all three Office sources. The generated Producer field remained. That result is useful precisely because it narrows the claim: the requested source properties were removed, while the PDF can still identify the software that wrote it. Do not turn that into a promise of an entirely empty metadata dictionary.
Complete working example
OfficeMetadataDemo is the entry point in the companion Maven project. It creates Result/, runs all three conversion methods with false and true, and invokes PropertyChecks. The utility is kept separate from the feature methods so the conversion snippets stay readable. RUN.md explains how to apply your own license locally. The included documents are fictional and can be used without a customer-data dependency.
Real-world applications
Customer report delivery
An export service can produce the external PDF only after a report is approved. Apply the property policy in that conversion path and keep the original Office document in its existing internal location. Avoid bundling the retained controls into the customer package. They exist here to make testing observable.
Mixed Office submissions
A team may receive narrative reports, worksheets and presentation summaries. Use a typed loader for each input family and apply a documented policy consistently. We would keep the file-family decision visible in code rather than infer support from one successful DOCX example. Add representative fixtures when introducing another template.
Best practices and tips
Keep cleanup and redaction separate in your requirements. Decide which properties are needed for provenance before clearing them. Store delivery outputs apart from internal controls and treat license setup as local configuration. When upgrading the SDK, rerun both retained and clean variants so an unexpected change is visible on either side of the comparison.
Troubleshooting common issues
If the full demonstration stops in evaluation mode, apply a license covering 26.10 in your local copy and rerun it. If a marker remains in visible text, that is outside this property’s storage check. If PDF input cleanup is your requirement, do not substitute it into this sample: a separate 26.10 check failed with CreationDate value is empty when built-in clearing was enabled. The article’s tested source scope is Office.
Conclusion
Start with the supplied fixtures and inspect the retained and cleaned pairs. Verify the named source properties, then review the actual PDF content. Replace the fixtures with approved templates only after that comparison behaves as expected. Keep the export policy close to the load options so the next developer can see which properties leave the system.