diff --git a/src/docx/opc/constants.py b/src/docx/opc/constants.py index 89d3c16cc..c304cf3d7 100644 --- a/src/docx/opc/constants.py +++ b/src/docx/opc/constants.py @@ -313,6 +313,10 @@ class RELATIONSHIP_TYPE: "http://schemas.openxmlformats.org/package/2006/relationships/metada" "ta/core-properties" ) + CORE_PROPERTIES_OFFICEDOCUMENT = ( + "http://schemas.openxmlformats.org/officedocument/2006/relationships" + "/metadata/core-properties" + ) CUSTOM_PROPERTIES = ( "http://schemas.openxmlformats.org/officeDocument/2006/relationships" "/custom-properties" diff --git a/src/docx/opc/package.py b/src/docx/opc/package.py index 3b1eef256..e8a10bac5 100644 --- a/src/docx/opc/package.py +++ b/src/docx/opc/package.py @@ -175,9 +175,12 @@ def _core_properties_part(self) -> CorePropertiesPart: try: return cast(CorePropertiesPart, self.part_related_by(RT.CORE_PROPERTIES)) except KeyError: - core_properties_part = CorePropertiesPart.default(self) - self.relate_to(core_properties_part, RT.CORE_PROPERTIES) - return core_properties_part + try: + return cast(CorePropertiesPart, self.part_related_by(RT.CORE_PROPERTIES_OFFICEDOCUMENT)) + except KeyError: + core_properties_part = CorePropertiesPart.default(self) + self.relate_to(core_properties_part, RT.CORE_PROPERTIES) + return core_properties_part class Unmarshaller: