docx_parser_converter.docx_parsers.models.numbering_models module
- class docx_parser_converter.docx_parsers.models.numbering_models.NumberingInstance(*, numId: int, levels: List[NumberingLevel])[source]
Bases:
BaseModelRepresents an instance of a numbering definition.
Example
The following is an example of a numbering instance element in a numbering.xml file:
<w:num w:numId="1"> <w:abstractNumId w:val="0"/> <w:lvlOverride w:ilvl="0"> <w:startOverride w:val="1"/> </w:lvlOverride> </w:num>
- levels: List[NumberingLevel]
- 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]] = {'levels': FieldInfo(annotation=List[NumberingLevel], required=True, description='The list of levels in the numbering definition.'), '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.numbering_models.NumberingLevel(*, numId: int, ilvl: int, start: int, numFmt: str, lvlText: str, lvlJc: str, counter: int | None = None, indent: IndentationProperties | None = None, tab_pt: float | None = None, fonts: FontProperties | None = None)[source]
Bases:
BaseModelRepresents a specific level in a numbering scheme.
Example
The following is an example of a numbering level element in a numbering.xml file:
<w:lvl w:ilvl="0"> <w:start w:val="1"/> <w:numFmt w:val="decimal"/> <w:lvlText w:val="%1."/> <w:lvlJc w:val="left"/> <w:pPr> <w:ind w:left="720" w:hanging="360"/> </w:pPr> <w:rPr> <w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/> </w:rPr> </w:lvl>
- counter: int | None
- fonts: FontProperties | None
- ilvl: int
- indent: IndentationProperties | None
- lvlJc: str
- lvlText: 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]] = {'counter': FieldInfo(annotation=Union[int, NoneType], required=False, default=None, description='A counter for the level.'), 'fonts': FieldInfo(annotation=Union[FontProperties, NoneType], required=False, default=None, description='The font properties for the level.'), 'ilvl': FieldInfo(annotation=int, required=True, description='The indent level of the numbering.'), 'indent': FieldInfo(annotation=Union[IndentationProperties, NoneType], required=False, default=None, description='The indentation properties for the level.'), 'lvlJc': FieldInfo(annotation=str, required=True, description='The justification of the level text.'), 'lvlText': FieldInfo(annotation=str, required=True, description='The text to be displayed for the level.'), 'numFmt': FieldInfo(annotation=str, required=True, description='The format of the numbering (e.g., decimal, bullet).'), 'numId': FieldInfo(annotation=int, required=True, description='The ID of the numbering definition.'), 'start': FieldInfo(annotation=int, required=True, description='The start value for the numbering level.'), 'tab_pt': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='The tab position 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.
- numFmt: str
- numId: int
- start: int
- tab_pt: float | None
- class docx_parser_converter.docx_parsers.models.numbering_models.NumberingSchema(*, instances: List[NumberingInstance])[source]
Bases:
BaseModelRepresents the overall numbering schema for the document.
Example
The following is an example of a numbering schema structure:
<w:numbering> <w:abstractNum w:abstractNumId="0"> <w:lvl w:ilvl="0"> <w:start w:val="1"/> <w:numFmt w:val="decimal"/> <w:lvlText w:val="%1."/> <w:lvlJc w:val="left"/> <w:pPr> <w:ind w:left="720" w:hanging="360"/> </w:pPr> <w:rPr> <w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/> </w:rPr> </w:lvl> </w:abstractNum> <w:num w:numId="1"> <w:abstractNumId w:val="0"/> </w:num> </w:numbering>
- instances: List[NumberingInstance]
- 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]] = {'instances': FieldInfo(annotation=List[NumberingInstance], required=True, description='The list of numbering instances 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.