docx_parser_converter.docx_to_html.docx_to_html_converter module

class docx_parser_converter.docx_to_html.docx_to_html_converter.DocxToHtmlConverter(docx_file: bytes, use_default_values: bool = True)[source]

Bases: object

A converter class for converting DOCX files to HTML.

convert_to_html() str[source]

Converts the DOCX file to HTML.

Returns:

The generated HTML content.

Return type:

str

Example

The following is an example of how to convert a DOCX file to HTML:

html_content = converter.convert_to_html()
print(html_content)
save_html_to_file(html_content: str, output_path: str) None[source]

Saves the generated HTML content to a file.

Parameters:
  • html_content (str) – The HTML content to save.

  • output_path (str) – The path to save the HTML file.

Example

The following is an example of how to save HTML content to a file:

converter.save_html_to_file(html_content, "path/to/output.html")