docx_parser_converter.docx_to_txt.txt_generator module
- class docx_parser_converter.docx_to_txt.txt_generator.TxtGenerator[source]
Bases:
objectClass to generate plain text from the document schema.
- static generate_txt(document_schema: DocumentSchema, numbering_schema, indent: bool) str[source]
Generate plain text from the document schema.
- Parameters:
document_schema (DocumentSchema) – The document schema.
numbering_schema – The numbering schema.
indent (bool) – Whether to apply indentation.
- Returns:
Plain text representation of the document.
- Return type:
str
Example
txt_content = TxtGenerator.generate_txt(document_schema, numbering_schema, indent=True)
- static generate_txt_body(doc_margins, elements, numbering_schema, indent: bool) str[source]
Generate the body text from document elements.
- Parameters:
doc_margins – The document margins.
elements – The document elements.
numbering_schema – The numbering schema.
indent (bool) – Whether to apply indentation.
- Returns:
Body text as a string.
- Return type:
str
Example
body_text = TxtGenerator.generate_txt_body(doc_margins, elements, numbering_schema, indent=True)