docx_parser_converter.docx_parsers.models.paragraph_models module
- class docx_parser_converter.docx_parsers.models.paragraph_models.BreakContent(*, break_type: str = 'textWrapping')[source]
Bases:
BaseModelRepresents a line or page break within a run.
- break_type: str
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'break_type': FieldInfo(annotation=str, required=False, default='textWrapping', description='The type of break (e.g., textWrapping, page).')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class docx_parser_converter.docx_parsers.models.paragraph_models.Numbering(*, ilvl: int, numId: int)[source]
Bases:
BaseModelRepresents the numbering properties of a paragraph.
Example
The following is an example of a numbering element in a paragraph properties element:
<w:numPr> <w:ilvl w:val="0"/> <w:numId w:val="1"/> </w:numPr>
- ilvl: int
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'ilvl': FieldInfo(annotation=int, required=True, description='The indent level of the numbering.'), 'numId': FieldInfo(annotation=int, required=True, description='The ID of the numbering definition.')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- numId: int
- class docx_parser_converter.docx_parsers.models.paragraph_models.Paragraph(*, properties: ParagraphStyleProperties, runs: List[Run], numbering: Numbering | None = None)[source]
Bases:
BaseModelRepresents a paragraph in the document, containing text runs and optional numbering.
Example
The following is an example of a paragraph element in a document:
<w:p> <w:pPr> <w:pStyle w:val="Heading1"/> <w:numPr> <w:ilvl w:val="0"/> <w:numId w:val="1"/> </w:numPr> </w:pPr> <w:r> <w:t>Example text</w:t> </w:r> </w:p>
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'numbering': FieldInfo(annotation=Union[Numbering, NoneType], required=False, default=None, description='The numbering properties, if the paragraph is part of a list.'), 'properties': FieldInfo(annotation=ParagraphStyleProperties, required=True, description='The style properties of the paragraph.'), 'runs': FieldInfo(annotation=List[Run], required=True, description='The list of text runs within the paragraph.')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- properties: ParagraphStyleProperties
- class docx_parser_converter.docx_parsers.models.paragraph_models.Run(*, contents: List[RunContent], properties: RunStyleProperties | None = None)[source]
Bases:
BaseModelRepresents a run within a paragraph, containing text and formatting properties.
Example
The following is an example of a run element in a paragraph:
<w:r> <w:rPr> <w:b/> <w:color w:val="FF0000"/> </w:rPr> <w:t>Example text</w:t> </w:r>
- contents: List[RunContent]
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'contents': FieldInfo(annotation=List[RunContent], required=True, description='The list of run contents (text or tabs).'), 'properties': FieldInfo(annotation=Union[RunStyleProperties, NoneType], required=False, default=None, description='The style properties of the run.')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- properties: RunStyleProperties | None
- class docx_parser_converter.docx_parsers.models.paragraph_models.RunContent(*, run: TextContent | TabContent | BreakContent)[source]
Bases:
BaseModelRepresents the content of a run, which can be either text or a tab.
Example
The following is an example of run contents in a run element:
<w:r> <w:t>Example text</w:t> <w:tab/> </w:r>
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'run': FieldInfo(annotation=Union[TextContent, TabContent, BreakContent], required=True, description='The content of the run.')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- run: TextContent | TabContent | BreakContent
- class docx_parser_converter.docx_parsers.models.paragraph_models.TabContent(*, type: str = 'tab')[source]
Bases:
BaseModelRepresents a tab character in a run.
Example
The following is an example of a tab element in a run:
<w:r> <w:tab/> </w:r>
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'type': FieldInfo(annotation=str, required=False, default='tab', description="The type of content, default is 'tab'.")}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- type: str
- class docx_parser_converter.docx_parsers.models.paragraph_models.TextContent(*, text: str)[source]
Bases:
BaseModelRepresents text content in a run.
Example
The following is an example of a text element in a run:
<w:r> <w:t>Example text</w:t> </w:r>
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'text': FieldInfo(annotation=str, required=True, description='The text content.')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- text: str