` ` element, the root element of the Core Properties part. Stored as `/docProps/core.xml`. Implements many of the Dublin Core document metadata elements. String elements resolve to an empty string ("") if the element is not present in the XML. String elements are limit
| 15 | |
| 16 | |
| 17 | class CT_CoreProperties(BaseOxmlElement): |
| 18 | """`<cp:coreProperties>` element, the root element of the Core Properties part. |
| 19 | |
| 20 | Stored as `/docProps/core.xml`. Implements many of the Dublin Core document metadata |
| 21 | elements. String elements resolve to an empty string ("") if the element is not |
| 22 | present in the XML. String elements are limited in length to 255 unicode characters. |
| 23 | """ |
| 24 | |
| 25 | get_or_add_revision: Callable[[], etree_Element] |
| 26 | |
| 27 | category = ZeroOrOne("cp:category", successors=()) |
| 28 | contentStatus = ZeroOrOne("cp:contentStatus", successors=()) |
| 29 | created = ZeroOrOne("dcterms:created", successors=()) |
| 30 | creator = ZeroOrOne("dc:creator", successors=()) |
| 31 | description = ZeroOrOne("dc:description", successors=()) |
| 32 | identifier = ZeroOrOne("dc:identifier", successors=()) |
| 33 | keywords = ZeroOrOne("cp:keywords", successors=()) |
| 34 | language = ZeroOrOne("dc:language", successors=()) |
| 35 | lastModifiedBy = ZeroOrOne("cp:lastModifiedBy", successors=()) |
| 36 | lastPrinted = ZeroOrOne("cp:lastPrinted", successors=()) |
| 37 | modified = ZeroOrOne("dcterms:modified", successors=()) |
| 38 | revision: etree_Element | None = ZeroOrOne( # pyright: ignore[reportAssignmentType] |
| 39 | "cp:revision", successors=() |
| 40 | ) |
| 41 | subject = ZeroOrOne("dc:subject", successors=()) |
| 42 | title = ZeroOrOne("dc:title", successors=()) |
| 43 | version = ZeroOrOne("cp:version", successors=()) |
| 44 | |
| 45 | _coreProperties_tmpl = "<cp:coreProperties %s/>\n" % nsdecls("cp", "dc", "dcterms") |
| 46 | |
| 47 | @classmethod |
| 48 | def new(cls) -> CT_CoreProperties: |
| 49 | """Return a new `<cp:coreProperties>` element.""" |
| 50 | xml = cls._coreProperties_tmpl |
| 51 | coreProperties = cast(CT_CoreProperties, parse_xml(xml)) |
| 52 | return coreProperties |
| 53 | |
| 54 | @property |
| 55 | def author_text(self) -> str: |
| 56 | """The text in the `dc:creator` child element.""" |
| 57 | return self._text_of_element("creator") |
| 58 | |
| 59 | @author_text.setter |
| 60 | def author_text(self, value: str): |
| 61 | self._set_element_text("creator", value) |
| 62 | |
| 63 | @property |
| 64 | def category_text(self) -> str: |
| 65 | return self._text_of_element("category") |
| 66 | |
| 67 | @category_text.setter |
| 68 | def category_text(self, value: str): |
| 69 | self._set_element_text("category", value) |
| 70 | |
| 71 | @property |
| 72 | def comments_text(self) -> str: |
| 73 | return self._text_of_element("description") |
| 74 |