MCPcopy Index your code
hub / github.com/python-openxml/python-docx / CorePropertiesPart

Class CorePropertiesPart

src/docx/opc/parts/coreprops.py:18–48  ·  view source on GitHub ↗

Corresponds to part named ``/docProps/core.xml``. The "core" is short for "Dublin Core" and contains document metadata relatively common across documents of all types, not just DOCX.

Source from the content-addressed store, hash-verified

16
17
18class CorePropertiesPart(XmlPart):
19 """Corresponds to part named ``/docProps/core.xml``.
20
21 The "core" is short for "Dublin Core" and contains document metadata relatively common across
22 documents of all types, not just DOCX.
23 """
24
25 @classmethod
26 def default(cls, package: OpcPackage):
27 """Return a new |CorePropertiesPart| object initialized with default values for
28 its base properties."""
29 core_properties_part = cls._new(package)
30 core_properties = core_properties_part.core_properties
31 core_properties.title = "Word Document"
32 core_properties.last_modified_by = "python-docx"
33 core_properties.revision = 1
34 core_properties.modified = dt.datetime.now(dt.timezone.utc)
35 return core_properties_part
36
37 @property
38 def core_properties(self):
39 """A |CoreProperties| object providing read/write access to the core properties
40 contained in this core properties part."""
41 return CoreProperties(self.element)
42
43 @classmethod
44 def _new(cls, package: OpcPackage) -> CorePropertiesPart:
45 partname = PackURI("/docProps/core.xml")
46 content_type = CT.OPC_CORE_PROPERTIES
47 coreProperties = CT_CoreProperties.new()
48 return CorePropertiesPart(partname, content_type, coreProperties, package)

Callers 2

_newMethod · 0.85

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…