Summary
Every presentation created with Presentation() (no template argument) and
saved carries Steve Canny as the "Last Modified By" document property.
The value comes from the bundled default template, not from user code.
Steps to reproduce
from pptx import Presentation
prs = Presentation()
prs.save("out.pptx")
Then inspect docProps/core.xml inside out.pptx:
<dc:creator></dc:creator>
<cp:lastModifiedBy>Steve Canny</cp:lastModifiedBy>
<dcterms:created xsi:type="dcterms:W3CDTF">2013-01-27T09:14:16Z</dcterms:created>
<dcterms:modified xsi:type="dcterms:W3CDTF">2013-01-27T09:15:58Z</dcterms:modified>
PowerPoint shows "Steve Canny" under File > Info > Related People.
Expected behavior
A freshly generated presentation should not name a specific person. The
library already uses python-pptx as the default last_modified_by in
CorePropertiesPart.default(), so the template should match that.
Root cause
src/pptx/templates/default.pptx ships a docProps/core.xml with
cp:lastModifiedBy set to Steve Canny and 2013-era timestamps.
Package.core_properties returns the existing part as-is, and
CorePropertiesPart.default() only runs when the part is missing, so the
template value is what ends up in the saved file. save() does not touch
core properties either.
Workaround
Set the properties before saving:
prs.core_properties.author = "..."
prs.core_properties.last_modified_by = "..."
Proposed fix
Rewrite docProps/core.xml in the default template so that
cp:lastModifiedBy is python-pptx, refresh the timestamps, and add a
test that guards against a personal name reappearing.
I have this ready on a branch (tests and behave suite pass):
https://github.com/RyoKakomi/python-pptx/tree/fix/default-template-core-props
Happy to open a PR if this is welcome.
Environment
- python-pptx 1.0.2
- Python 3.13
- macOS
Summary
Every presentation created with
Presentation()(no template argument) andsaved carries
Steve Cannyas the "Last Modified By" document property.The value comes from the bundled default template, not from user code.
Steps to reproduce
Then inspect
docProps/core.xmlinsideout.pptx:PowerPoint shows "Steve Canny" under File > Info > Related People.
Expected behavior
A freshly generated presentation should not name a specific person. The
library already uses
python-pptxas the defaultlast_modified_byinCorePropertiesPart.default(), so the template should match that.Root cause
src/pptx/templates/default.pptxships adocProps/core.xmlwithcp:lastModifiedByset toSteve Cannyand 2013-era timestamps.Package.core_propertiesreturns the existing part as-is, andCorePropertiesPart.default()only runs when the part is missing, so thetemplate value is what ends up in the saved file.
save()does not touchcore properties either.
Workaround
Set the properties before saving:
Proposed fix
Rewrite
docProps/core.xmlin the default template so thatcp:lastModifiedByispython-pptx, refresh the timestamps, and add atest that guards against a personal name reappearing.
I have this ready on a branch (tests and behave suite pass):
https://github.com/RyoKakomi/python-pptx/tree/fix/default-template-core-props
Happy to open a PR if this is welcome.
Environment