Paper Office
paper-docxAPI referencecontrols

Control

paper-docx 0.2.0 API reference

Live proxy for one content control.

Control(sdt: '_Element', story: str, document: 'Document')

Attributes

alias

attributealiasOptional[str]

control_type

attributecontrol_typestr

is_data_bound

attributeis_data_boundbool

showing_placeholder

attributeshowing_placeholderbool

tag

attributetagOptional[str]

value

attributevalue'Union[str, bool]'

The control's current value (bool for checkboxes, text otherwise).

Functions

info

funcinfo() -> ControlInfo

Returns

docx.controls.ControlInfo

set_value

funcset_value(value: 'Union[str, bool, dt.date, dt.datetime]') -> None

Set the control's value, validating fully before mutating anything.

Text and rich-text controls take a string, checkboxes a bool, dropdowns a value from their w:listItem choices, dates an ISO date. Refuses a protected document, a stale or foreign control, a locked or data-bound surface, a picture, group or building-block control, a dropdown value outside its choices, and an unsupported date format.

paramvalue'Union[str, bool, dt.date, dt.datetime]'

Returns

None

On this page