Paper Office
paper-docxAPI referenceoxml.xmlchemy

OptionalAttribute

paper-docx 0.2.0 API reference

Defines an optional attribute on a custom element class.

An optional attribute returns a default value when not present for reading. When assigned None, the attribute is removed, but still returns the default value when one is specified.

OptionalAttribute(attr_name: str, simple_type: Type[BaseXmlEnum] | Type[BaseSimpleType], default: BaseXmlEnum | BaseSimpleType | str | bool | None = None)

Functions

populate_class_members

funcpopulate_class_members(element_cls: MetaOxmlElement, prop_name: str) -> None

Add the appropriate methods to element_cls.

paramelement_clsMetaOxmlElement
paramprop_namestr

Returns

None

On this page