docx_parser_converter.docx_parsers.models.styles_models module

class docx_parser_converter.docx_parsers.models.styles_models.FontProperties(*, ascii: str | None = None, hAnsi: str | None = None, eastAsia: str | None = None, cs: str | None = None)[source]

Bases: BaseModel

Represents the font properties for text.

Example

The following is an example of font properties in a run properties element:

<w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/>
ascii: str | None
cs: str | None
eastAsia: str | None
hAnsi: str | None
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]] = {'ascii': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The ASCII font.'), 'cs': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The complex script font.'), 'eastAsia': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The East Asian font.'), 'hAnsi': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The high ANSI font.')}

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.styles_models.IndentationProperties(*, left_pt: float | None = None, right_pt: float | None = None, firstline_pt: float | None = None)[source]

Bases: BaseModel

Represents the indentation properties for a paragraph.

Example

The following is an example of indentation properties in a paragraph properties element:

<w:ind w:left="720" w:right="720" w:firstLine="720"/>
firstline_pt: float | None
left_pt: float | None
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]] = {'firstline_pt': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='The first line indentation in points.'), 'left_pt': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='The left indentation in points.'), 'right_pt': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='The right indentation in points.')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

right_pt: float | None
class docx_parser_converter.docx_parsers.models.styles_models.LanguageProperties(*, val: str | None = None, eastAsia: str | None = None, bidi: str | None = None)[source]

Bases: BaseModel

Represents the language properties for text.

Example

The following is an example of language properties in a run properties element:

<w:lang w:val="en-US"/>
bidi: str | None
eastAsia: str | None
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]] = {'bidi': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The bidirectional language.'), 'eastAsia': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The East Asian language.'), 'val': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The language value.')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

val: str | None
class docx_parser_converter.docx_parsers.models.styles_models.ParagraphStyleProperties(*, style_id: str | None = None, spacing: SpacingProperties | None = None, indent: IndentationProperties | None = None, outline_level: int | None = None, widow_control: bool | None = None, suppress_auto_hyphens: bool | None = None, bidi: bool | None = None, justification: str | None = None, highlight: str | None = None, keep_next: bool | None = None, suppress_line_numbers: bool | None = None, tabs: List[TabStop] | None = None)[source]

Bases: BaseModel

Represents the style properties for a paragraph.

Example

The following is an example of paragraph style properties in a style element:

<w:pPr>
    <w:spacing w:before="240" w:after="240" w:line="360"/>
    <w:ind w:left="720" w:right="720" w:firstLine="720"/>
    ...
</w:pPr>
bidi: bool | None
highlight: str | None
indent: IndentationProperties | None
justification: str | None
keep_next: bool | None
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]] = {'bidi': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='The bidirectional setting.'), 'highlight': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The paragraph highlight color.'), 'indent': FieldInfo(annotation=Union[IndentationProperties, NoneType], required=False, default=None, description='The indentation properties.'), 'justification': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The justification setting.'), 'keep_next': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='The keep next setting.'), 'outline_level': FieldInfo(annotation=Union[int, NoneType], required=False, default=None, description='The outline level.'), 'spacing': FieldInfo(annotation=Union[SpacingProperties, NoneType], required=False, default=None, description='The spacing properties.'), 'style_id': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The style ID of the paragraph.'), 'suppress_auto_hyphens': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='The suppress auto hyphens setting.'), 'suppress_line_numbers': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='The suppress line numbers setting.'), 'tabs': FieldInfo(annotation=Union[List[TabStop], NoneType], required=False, default=None, description='The list of tab stops.'), 'widow_control': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='The widow control setting.')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

outline_level: int | None
spacing: SpacingProperties | None
style_id: str | None
suppress_auto_hyphens: bool | None
suppress_line_numbers: bool | None
tabs: List[TabStop] | None
widow_control: bool | None
class docx_parser_converter.docx_parsers.models.styles_models.RunStyleProperties(*, font: FontProperties | None = None, size_pt: float | None = None, color: str | None = None, bold: bool | None = None, italic: bool | None = None, underline: str | None = None, underline_color: str | None = None, strikethrough: bool | None = None, double_strikethrough: bool | None = None, hidden: bool | None = None, lang: LanguageProperties | None = None, highlight: str | None = None, shading: str | None = None, text_position_pt: float | None = None, vertical_align: str | None = None, kerning: int | None = None, character_spacing_pt: float | None = None, emboss: bool | None = None, outline: bool | None = None, shadow: bool | None = None, all_caps: bool | None = None, small_caps: bool | None = None)[source]

Bases: BaseModel

Represents the style properties for a text run.

Example

The following is an example of run style properties in a style element:

<w:rPr>
    <w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/>
    <w:sz w:val="24"/>
    <w:color w:val="FF0000"/>
    ...
</w:rPr>
all_caps: bool | None
bold: bool | None
character_spacing_pt: float | None
color: str | None
double_strikethrough: bool | None
emboss: bool | None
font: FontProperties | None
hidden: bool | None
highlight: str | None
italic: bool | None
kerning: int | None
lang: LanguageProperties | None
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]] = {'all_caps': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='The all caps setting.'), 'bold': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='The bold setting.'), 'character_spacing_pt': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='The character spacing in points.'), 'color': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The font color.'), 'double_strikethrough': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='The double strikethrough setting.'), 'emboss': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='The emboss setting.'), 'font': FieldInfo(annotation=Union[FontProperties, NoneType], required=False, default=None, description='The font properties.'), 'hidden': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='The hidden setting.'), 'highlight': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The highlight color.'), 'italic': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='The italic setting.'), 'kerning': FieldInfo(annotation=Union[int, NoneType], required=False, default=None, description='The kerning value.'), 'lang': FieldInfo(annotation=Union[LanguageProperties, NoneType], required=False, default=None, description='The language properties.'), 'outline': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='The outline setting.'), 'shading': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The shading color.'), 'shadow': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='The shadow setting.'), 'size_pt': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='The font size in points.'), 'small_caps': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='The small caps setting.'), 'strikethrough': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='The strikethrough setting.'), 'text_position_pt': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='The text position in points.'), 'underline': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The underline setting.'), 'underline_color': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The explicit underline color.'), 'vertical_align': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The vertical alignment of the text (e.g., superscript or subscript).')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

outline: bool | None
shading: str | None
shadow: bool | None
size_pt: float | None
small_caps: bool | None
strikethrough: bool | None
text_position_pt: float | None
underline: str | None
underline_color: str | None
vertical_align: str | None
class docx_parser_converter.docx_parsers.models.styles_models.SpacingProperties(*, before_pt: float | None = None, after_pt: float | None = None, line_pt: float | None = None)[source]

Bases: BaseModel

Represents the spacing properties for a paragraph.

Example

The following is an example of spacing properties in a paragraph properties element:

<w:spacing w:before="240" w:after="240" w:line="360"/>
after_pt: float | None
before_pt: float | None
line_pt: float | None
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]] = {'after_pt': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='The space after the paragraph in points.'), 'before_pt': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='The space before the paragraph in points.'), 'line_pt': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='The line spacing in points.')}

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.styles_models.Style(*, style_id: str, name: str, based_on: str | None = None, paragraph_properties: ParagraphStyleProperties | None = None, run_properties: RunStyleProperties | None = None)[source]

Bases: BaseModel

Represents a style definition in the document.

Example

The following is an example of a style definition in a styles.xml file:

<w:style w:styleId="Heading1" w:type="paragraph">
    ...
</w:style>
based_on: str | None
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]] = {'based_on': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The style this style is based on.'), 'name': FieldInfo(annotation=str, required=True, description='The name of the style.'), 'paragraph_properties': FieldInfo(annotation=Union[ParagraphStyleProperties, NoneType], required=False, default=None, description='The paragraph style properties.'), 'run_properties': FieldInfo(annotation=Union[RunStyleProperties, NoneType], required=False, default=None, description='The run style properties.'), 'style_id': FieldInfo(annotation=str, required=True, description='The ID of the style.')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str
paragraph_properties: ParagraphStyleProperties | None
run_properties: RunStyleProperties | None
style_id: str
class docx_parser_converter.docx_parsers.models.styles_models.StyleDefaults(*, paragraph: str | None = None, character: str | None = None, numbering: str | None = None, table: str | None = None)[source]

Bases: BaseModel

Represents the default styles for various elements in the document.

Example

The following is an example of style defaults in a styles.xml file:

<w:style w:type="character" w:default="1" w:styleId="DefaultParagraphFont">
    ...
</w:style>
character: str | None
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]] = {'character': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The default character style.'), 'numbering': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The default numbering style.'), 'paragraph': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The default paragraph style.'), 'table': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The default table style.')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

numbering: str | None
paragraph: str | None
table: str | None
class docx_parser_converter.docx_parsers.models.styles_models.StylesSchema(*, styles: List[Style], style_type_defaults: StyleDefaults, doc_defaults_rpr: RunStyleProperties | None = None, doc_defaults_ppr: ParagraphStyleProperties | None = None)[source]

Bases: BaseModel

Represents the overall styles schema for the document.

Example

The following is an example of a styles schema structure:

<w:styles>
    <w:style w:styleId="Heading1" w:type="paragraph">
        ...
    </w:style>
    <w:docDefaults>
        <w:rPrDefault>
            ...
        </w:rPrDefault>
        <w:pPrDefault>
            ...
        </w:pPrDefault>
    </w:docDefaults>
</w:styles>
doc_defaults_ppr: ParagraphStyleProperties | None
doc_defaults_rpr: RunStyleProperties | None
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]] = {'doc_defaults_ppr': FieldInfo(annotation=Union[ParagraphStyleProperties, NoneType], required=False, default=None, description='The default paragraph properties.'), 'doc_defaults_rpr': FieldInfo(annotation=Union[RunStyleProperties, NoneType], required=False, default=None, description='The default run properties.'), 'style_type_defaults': FieldInfo(annotation=StyleDefaults, required=True, description='The default styles for different elements.'), 'styles': FieldInfo(annotation=List[Style], required=True, description='The list of styles in the document.')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

style_type_defaults: StyleDefaults
styles: List[Style]
class docx_parser_converter.docx_parsers.models.styles_models.TabStop(*, val: str, pos: float)[source]

Bases: BaseModel

Represents a tab stop within a paragraph.

Example

The following is an example of a tab stop in a tabs element:

<w:tab w:val="left" w:pos="720"/>
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]] = {'pos': FieldInfo(annotation=float, required=True, description='The position of the tab stop in points.'), 'val': FieldInfo(annotation=str, required=True, description='The type of tab stop.')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

pos: float
val: str