Paper Office
paper-docxAPI referencelinks

docx.links

paper-docx 0.2.0 API reference

Create and retarget hyperlinks on existing text.

funcadd_hyperlink(document: 'Document', span: 'Span', address: str) -> Hyperlink

Wrap span's runs in a hyperlink pointing at address.

Visible text stays; Word shows it in the Hyperlink character style, which this defines when the document lacks it. Refuses a protected document, a stale or foreign span, a span crossing paragraphs, a field result, an existing hyperlink, and a data-bound, locked or plain-text control surface.

paramdocument'Document'
paramspan'Span'
paramaddressstr

Returns

docx.text.hyperlink.Hyperlink

check_install

funccheck_install() -> None

Refuse when paper-docx and python-docx are both installed.

Returns

None

require_span_owner

funcrequire_span_owner(document: 'Document', span: 'Span', *, argument: str = 'span') -> None

Refuse a live span captured from a different document package.

paramdocument'Document'
paramspan'Span'
paramargumentstr
= 'span'

Returns

None

rollback_on_error

funcrollback_on_error(document: 'Document', *participants: Any) -> Generator[None, None, None]

Restore the live package and named mutable proxies after an error.

paramdocument'Document'
paramparticipantsAny
= ()

Returns

typing.Generator[None, None, None]

On this page