Word Author and Revision Data: Keep or Clear Before Export?
The core string attributes can be cleared, but the date attribute cannot be assigned None. Below, we retain the date and demonstrate only the cleaning of string
Word files carry more identifying information than most people expect. Your name, your username, and notes from earlier drafts can sit in the file properties, in comments, and in tracked changes, and they can all reach a client without anyone noticing. If you generate or convert Word documents with a script, you need a repeatable way to check for this before delivery.
This guide is for developers and document teams who automate Word output with Python. It explains what the core_properties interface in python-docx can clean, where it stops, and how to build a checklist that covers the rest. The code examples use synthetic data built in memory, so you can test the logic safely before you touch real files.
You will come away with a clear boundary between what a script can handle and what needs manual review or other tools, plus an acceptance checklist you can add to your pipeline.
They do not guarantee results for every real file or product. Keep the original copies of any important documents, and check your output against the boundaries and acceptance criteria described here.
How do you clean author and revision data before exporting a Word file? The short answer
Clear the core string properties with a script, keep the date property (it cannot be set to None), and then review comments, revisions, custom properties, embedded media, and templates by hand or with other tools.
| Your situation | What to do | Why |
|---|---|---|
| You want to remove the author name and title from a generated file | Clear or rewrite the core_properties string fields | python-docx exposes these fields for reading and writing |
| You need a last-modified date in the file | Keep the date attribute | The date attribute cannot be assigned None |
| Your documents contain review comments | Iterate through doc.comments and process each comment | Comment authors are not covered by core_properties |
| Your documents were edited with tracked changes | Parse the w:ins and w:del XML nodes | Revision history keeps the editor's identity |
| You need a full privacy review | Run the acceptance checklist item by item | Clearing core_properties alone is not a complete privacy scan |
What problem does this guide address?
The core string attributes can be cleared, but the date attribute cannot be assigned None. This guide keeps the date and demonstrates only the cleaning of string fields and their deserialization. It is not a complete data desensitizer. Annotations, revisions, body text, and custom attributes must be examined separately.
Which metadata does a script clear, and which does it miss?
What core_properties covers
- The core string attributes (such as author, title, and comments) can be cleared.
- The date attribute cannot be assigned
None, so keep it in place. - The interface reads and writes Dublin Core standard properties, but it does not sanitize anything automatically.
What core_properties does not cover
core_properties is only a small part of the metadata in a Word document. It does not include:
- Author and initials stored in annotations
- Author information in the revision history
- Body text
- Custom document properties
- Metadata inside embedded objects or images
- Template paths and macro code
Clearing core_properties is not the same as a full privacy scan. Any script that claims to have "cleared document metadata" but only touched core_properties has an incomplete result.
Why clearing the author field is not enough
When you batch-generate or convert Word documents, the most awkward moment is rarely a formatting error. It is when the client receives the file and finds your local username, draft notes from testing, or the title of an unrelated document from earlier work in the file properties.
Treating core_properties cleanup as a full privacy scan is the most common misjudgment in engineering. This guide focuses on handling core_properties correctly and verifiably, and on defining its boundaries clearly. It does not offer a one-click masking tool. Instead, it gives you reproducible validation logic and acceptance criteria so you can set reliable checkpoints in your automated workflow.
Synthetic example: correct cleaning versus typical wrong input
The example below is fully self-contained. It demonstrates the cleanup logic for core_properties. Dependencies are listed in the import section. The code constructs its inputs in memory. They do not guarantee results for real-world files.
Note: This code does not read actual files. All data is constructed in memory and is used only to illustrate API behavior and boundary handling. If you need to process real documents, prepare them yourself and pass the .docx file path or byte stream to Document().
from docx import Document
from io import BytesIO
from datetime import datetime
doc = Document()
doc.core_properties.author = "Synthetic Author"
doc.core_properties.title = "Synthetic Draft"
doc.core_properties.created = datetime(2024, 6, 1)
original_date = doc.core_properties.created
for field in ("author", "title", "subject", "keywords", "comments", "last_modified_by"):
setattr(doc.core_properties, field, "")
stream = BytesIO()
doc.save(stream)
stream.seek(0)
result = Document(stream)
assert result.core_properties.author == ""
assert result.core_properties.title == ""
assert result.core_properties.created == original_date
try:
doc.core_properties.created = None
except ValueError:
pass
else:
raise AssertionError("date setter must not silently accept None")
Acceptance checklist: what the code can and cannot do
Use this table to check each item before delivery.
| check item | code can handle | requires manual intervention/other tools | processing decision |
|---|---|---|---|
| core_properties.author/title/comments and 13 other items | ✅ | ❌ | is cleared or rewritten according to the type rules for |
| author/initials in the annotation | ❌ | ✅ | Iterate through doc.comments and process each one separately. |
| Author information in the revision history | ❌ | ✅ | must parse the w:ins/w:del XML nodes |
| custom document properties (custom properties) | ❌ | ✅ | Must be accessed via underlying XML or a dedicated library. |
| embedded OLE object/image's EXIF/metadata | ❌ | ✅ | requires a dedicated media processing library |
| document template path or macro code | ❌ | ✅ | checks settings and vbaProject |
| last_printed and other non-sensitive but redundant fields | ✅ | ⚠️ | Decide whether to retain in accordance with compliance requirements. |
The table shows the scope of core_properties clearly. For example, even after you clear core_properties.author, each comment in the document may still carry the original author's name, and the revision history may still record who edited the file. CoreProperties does not reach either of these.
During acceptance, check every row. For items marked ✅ in the "requires manual intervention/other tools" column, arrange extra processing or review.
Reference
Next steps
- Add the verification step for
core_propertiesto your CI/CD or documentation publishing pipeline. Use the assertion logic in this guide as the base template. - Sort your document types into categories, and write a specific SOP for each item marked "requires manual intervention/other tools".
- Do not assume cleaning is complete just because the author field is blank. Real protection comes from knowing exactly where the boundaries are.
Using this checklist for document translation
Translation work often mixes up content issues and formatting problems. Leave style, header, and table checks to the delivery checklist so reviewers know where to look.
OmniDoc translates PDF, Word, PowerPoint and Excel files: scanned pages are recognized first, table cells are translated one by one so tables keep their rows and columns, and a PDF comes back as both a bilingual and a translation-only file. Paid translation adds a glossary and context translation. If you want to start from real files, it is worth evaluating with your own samples.
🎯 Which approach fits you?
If you generate Word files from a script
Clear the core_properties string fields in your build step, and keep the date attribute. Then run the checklist for comments, revisions, and custom properties.
If your documents go through review with tracked changes
Parse the revision nodes as well. Clearing core_properties alone will leave the editor's identity in the file.
If you handle files for clients under compliance rules
Decide with your compliance team which non-sensitive fields, such as last_printed, should stay, and write the decision into your SOP.
❓ FAQ
1. Can I set the document date to None to hide it?
No. The date attribute cannot be assigned None, so keep it and focus on the string fields you need to clear.
2. Does clearing core_properties remove all personal information?
No. Comment authors, revision history, custom properties, embedded media, and template or macro paths are outside core_properties and need separate checks.
3. Can python-docx clean revision history automatically?
This guide does not cover that. Revision authors live in the w:ins and w:del XML nodes, so you need to parse those nodes yourself or use another tool.
4. Should I test with real client files?
Test with synthetic files first, keep original copies and verify results against the checklist.
📝 Summary
Clearing the string fields in core_properties is a useful starting point, but it is not a full privacy scan. Keep the date attribute, then check comments, revisions, custom properties, embedded media, and templates against the checklist before every delivery.
Try it now: upload a document and get it translated with the layout intact


