Converters

Converters

Internal API — The classes on this page are not part of the public API and are not exported from the top-level aspose.words_foss package. They are used internally by the export pipeline. Most developers should use Document.save() instead. See Core Management for the public API.

Aspose.Words FOSS for Python uses specialized converter classes to transform the internal document model into output formats. ParagraphConverter handles text and formatting, TableConverter handles table structures, and ListHandler manages list formatting. These classes are implementation details and may change without notice.


Paragraph Converter

ParagraphConverter transforms document paragraphs into the target output format. It inspects paragraph formatting, run-level styling, and inline content.

MethodDescription
ParagraphConverter.get_paragraph_info()Extract formatting information from a paragraph
ParagraphConverter.get_run_formatting()Get formatting details for a text run
ParagraphConverter.format_text()Apply formatting to text content

Table Converter

TableConverter converts document tables into the target format (such as Markdown tables).

MethodDescription
TableConverter.convert()Convert a table element to the output format

List Handler

ListHandler manages list state during document conversion, tracking list nesting, markers, and formatting.

MethodDescription
ListHandler.set_reader()Set the document reader for list context
ListHandler.reset()Reset list tracking state
ListHandler.get_list_info()Get list item details for a paragraph
ListHandler.format_list_item()Format a list item with marker and indentation
ListHandler.break_list()Signal end of a list sequence

Tips and Best Practices

  • Converters are used internally by the export pipeline — most developers interact with Document.save() instead
  • ParagraphConverter.format_text() respects code block context to avoid applying inline formatting inside code spans
  • ListHandler maintains state across consecutive list paragraphs — call reset() when starting a new document section

Common Issues

IssueCauseFix
Misaligned table columnsInput table has merged cellsTableConverter handles simple tables; merged cells may produce unexpected output
Broken list numberingList state not reset between sectionsCall ListHandler.reset() at section boundaries

API Reference Summary

Class / MethodDescription
ParagraphConverter.get_paragraph_info()Extract paragraph formatting
ParagraphConverter.get_run_formatting()Get run-level formatting
ParagraphConverter.format_text()Apply formatting to text
TableConverter.convert()Convert a table to output format
ListHandler.set_reader()Set document reader context
ListHandler.get_list_info()Get list item details
ListHandler.format_list_item()Format a list item
 English