docx_parser_converter.docx_to_txt.converters.run_converter module

class docx_parser_converter.docx_to_txt.converters.run_converter.RunConverter[source]

Bases: object

Class to convert runs to plain text.

static convert_run(run: Run) str[source]

Convert a run to plain text.

Parameters:

run (Run) – The run object.

Returns:

Plain text representation of the run.

Return type:

str

Example

run = Run(
    contents=[
        RunContent(run=TextContent(text="Hello")),
        RunContent(run=TabContent(type="tab")),
        RunContent(run=TextContent(text="world"))
    ],
    properties=RunStyleProperties()
)
run_text = RunConverter.convert_run(run)
print(run_text)  # Output: "Hello       world"