docx_parser_converter.docx_parsers.document.run_parser module

class docx_parser_converter.docx_parsers.document.run_parser.RunParser[source]

Bases: object

A parser for extracting run elements from the DOCX document structure.

This class handles the extraction of run properties and contents within a run element, converting them into a structured Run object for further processing or conversion to other formats like HTML.

extract_run_contents(r: Element) List[RunContent][source]

Extracts run contents from the given run XML element.

Parameters:

r (etree.Element) – The run XML element.

Returns:

The list of extracted run contents.

Return type:

List[RunContent]

Example

The following is an example of run contents in a document.xml file:

<w:r>
    <w:tab/>
    <w:t>Example text</w:t>
</w:r>
parse(r: Element) Run[source]

Parses a run from the given XML element.

Parameters:

r (etree.Element) – The run XML element.

Returns:

The parsed run.

Return type:

Run

Example

The following is an example of a run element in a document.xml file:

<w:r>
    <w:rPr>
        <w:b/>
        <w:color w:val="FF0000"/>
    </w:rPr>
    <w:t>Example text</w:t>
</w:r>