docx_parser_converter.docx_parsers.models.table_models module

class docx_parser_converter.docx_parsers.models.table_models.BorderProperties(*, color: str | None = None, size: int | None = None, space: int | None = None, val: str | None = None)[source]

Bases: BaseModel

Represents the border properties for a table cell.

Example

The following is an example of border properties in a table cell properties element:

<w:tcBorders>
    <w:top w:val="single" w:sz="4" w:space="0" w:color="000000"/>
    <w:left w:val="single" w:sz="4" w:space="0" w:color="000000"/>
    <w:bottom w:val="single" w:sz="4" w:space="0" w:color="000000"/>
    <w:right w:val="single" w:sz="4" w:space="0" w:color="000000"/>
</w:tcBorders>
color: 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]] = {'color': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The color of the border.'), 'size': FieldInfo(annotation=Union[int, NoneType], required=False, default=None, description='The size of the border.'), 'space': FieldInfo(annotation=Union[int, NoneType], required=False, default=None, description='The space between the border and the text.'), 'val': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The style of the border.')}

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

This replaces Model.__fields__ from Pydantic V1.

size: int | None
space: int | None
val: str | None
class docx_parser_converter.docx_parsers.models.table_models.MarginProperties(*, top: float | None = None, left: float | None = None, bottom: float | None = None, right: float | None = None)[source]

Bases: BaseModel

Represents the margin properties for a table cell.

Example

The following is an example of margin properties in a table cell properties element:

<w:tcMar>
    <w:top w:w="100" w:type="dxa"/>
    <w:left w:w="100" w:type="dxa"/>
    <w:bottom w:w="100" w:type="dxa"/>
    <w:right w:w="100" w:type="dxa"/>
</w:tcMar>
bottom: float | None
left: 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]] = {'bottom': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='The bottom margin in points.'), 'left': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='The left margin in points.'), 'right': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='The right margin in points.'), 'top': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='The top margin 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: float | None
top: float | None
class docx_parser_converter.docx_parsers.models.table_models.ShadingProperties(*, fill: str | None = None, val: str | None = None, color: str | None = None)[source]

Bases: BaseModel

Represents the shading properties for a table cell.

Example

The following is an example of shading properties in a table cell properties element:

<w:shd w:val="clear" w:color="auto" w:fill="FFFF00"/>
color: str | None
fill: 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]] = {'color': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The color of the shading.'), 'fill': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The fill color.'), 'val': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The shading pattern.')}

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.table_models.Table(*, properties: TableProperties | None = None, grid: TableGrid | None = None, rows: List[TableRow])[source]

Bases: BaseModel

Represents a table in the document.

Example

The following is an example of a table element in a document:

<w:tbl>
    <w:tblPr>...</w:tblPr>
    <w:tblGrid>...</w:tblGrid>
    <w:tr>...</w:tr>
</w:tbl>
grid: TableGrid | 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]] = {'grid': FieldInfo(annotation=Union[TableGrid, NoneType], required=False, default=None, description='The grid structure of the table.'), 'properties': FieldInfo(annotation=Union[TableProperties, NoneType], required=False, default=None, description='The properties of the table.'), 'rows': FieldInfo(annotation=List[TableRow], required=True, description='The list of rows in the table.')}

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: TableProperties | None
rows: List[TableRow]
class docx_parser_converter.docx_parsers.models.table_models.TableCell(*, properties: TableCellProperties | None = None, paragraphs: List[Paragraph])[source]

Bases: BaseModel

Represents a table cell in a table row.

Example

The following is an example of a table cell element:

<w:tc>
    <w:tcPr>...</w:tcPr>
    <w:p>...</w:p>
</w:tc>
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]] = {'paragraphs': FieldInfo(annotation=List[Paragraph], required=True, description='The list of paragraphs within the table cell.'), 'properties': FieldInfo(annotation=Union[TableCellProperties, NoneType], required=False, default=None, description='The properties of the table cell.')}

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

This replaces Model.__fields__ from Pydantic V1.

paragraphs: List[Paragraph]
properties: TableCellProperties | None
class docx_parser_converter.docx_parsers.models.table_models.TableCellBorders(*, top: BorderProperties | None = None, left: BorderProperties | None = None, bottom: BorderProperties | None = None, right: BorderProperties | None = None, insideH: BorderProperties | None = None, insideV: BorderProperties | None = None)[source]

Bases: BaseModel

Represents the border properties for a table cell.

Example

The following is an example of table cell borders in a table cell properties element:

<w:tcBorders>
    <w:top w:val="single" w:sz="4" w:space="0" w:color="000000"/>
    <w:left w:val="single" w:sz="4" w:space="0" w:color="000000"/>
    <w:bottom w:val="single" w:sz="4" w:space="0" w:color="000000"/>
    <w:right w:val="single" w:sz="4" w:space="0" w:color="000000"/>
    <w:insideH w:val="single" w:sz="4" w:space="0" w:color="000000"/>
    <w:insideV w:val="single" w:sz="4" w:space="0" w:color="000000"/>
</w:tcBorders>
bottom: BorderProperties | None
insideH: BorderProperties | None
insideV: BorderProperties | None
left: BorderProperties | 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]] = {'bottom': FieldInfo(annotation=Union[BorderProperties, NoneType], required=False, default=None, description='The bottom border properties.'), 'insideH': FieldInfo(annotation=Union[BorderProperties, NoneType], required=False, default=None, description='The inside horizontal border properties.'), 'insideV': FieldInfo(annotation=Union[BorderProperties, NoneType], required=False, default=None, description='The inside vertical border properties.'), 'left': FieldInfo(annotation=Union[BorderProperties, NoneType], required=False, default=None, description='The left border properties.'), 'right': FieldInfo(annotation=Union[BorderProperties, NoneType], required=False, default=None, description='The right border properties.'), 'top': FieldInfo(annotation=Union[BorderProperties, NoneType], required=False, default=None, description='The top border properties.')}

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: BorderProperties | None
top: BorderProperties | None
class docx_parser_converter.docx_parsers.models.table_models.TableCellProperties(*, tcW: TableWidth | None = None, tcBorders: TableCellBorders | None = None, shd: ShadingProperties | None = None, tcMar: MarginProperties | None = None, textDirection: str | None = None, vAlign: str | None = None, hideMark: bool | None = None, cellMerge: str | None = None, gridSpan: int | None = None)[source]

Bases: BaseModel

Represents the properties of a table cell.

Example

The following is an example of table cell properties in a table cell element:

<w:tc>
    <w:tcPr>
        <w:tcW w:w="5000" w:type="dxa"/>
        <w:tcBorders>...</w:tcBorders>
        <w:shd w:val="clear" w:color="auto" w:fill="FFFF00"/>
        <w:tcMar>...</w:tcMar>
        <w:textDirection w:val="btLr"/>
        <w:vAlign w:val="center"/>
        <w:gridSpan w:val="2"/>
    </w:tcPr>
    <w:p>...</w:p>
</w:tc>
cellMerge: str | None
gridSpan: int | None
hideMark: 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]] = {'cellMerge': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The cell merge properties.'), 'gridSpan': FieldInfo(annotation=Union[int, NoneType], required=False, default=None, description='The number of grid columns spanned by the table cell.'), 'hideMark': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='Indicates if the cell contains hidden marks.'), 'shd': FieldInfo(annotation=Union[ShadingProperties, NoneType], required=False, default=None, description='The shading properties of the table cell.'), 'tcBorders': FieldInfo(annotation=Union[TableCellBorders, NoneType], required=False, default=None, description='The borders of the table cell.'), 'tcMar': FieldInfo(annotation=Union[MarginProperties, NoneType], required=False, default=None, description='The margin properties of the table cell.'), 'tcW': FieldInfo(annotation=Union[TableWidth, NoneType], required=False, default=None, description='The width of the table cell.'), 'textDirection': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The text direction of the table cell.'), 'vAlign': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The vertical alignment of the table cell.')}

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

This replaces Model.__fields__ from Pydantic V1.

shd: ShadingProperties | None
tcBorders: TableCellBorders | None
tcMar: MarginProperties | None
tcW: TableWidth | None
textDirection: str | None
vAlign: str | None
class docx_parser_converter.docx_parsers.models.table_models.TableGrid(*, columns: List[float])[source]

Bases: BaseModel

Represents the grid structure of a table.

Example

The following is an example of a table grid element:

<w:tblGrid>
    <w:gridCol w:w="5000"/>
    <w:gridCol w:w="5000"/>
</w:tblGrid>
columns: List[float]
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]] = {'columns': FieldInfo(annotation=List[float], required=True, description='The list of column widths 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.table_models.TableIndent(*, type: str | None = None, width: float | None = None)[source]

Bases: BaseModel

Represents the indent of a table.

Example

The following is an example of a table indent element in a table properties element:

<w:tblInd w:type="dxa" w:w="200"/>
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=Union[str, NoneType], required=False, default=None, description="The type of indent (e.g., 'dxa')."), 'width': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='The indent width 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.

type: str | None
width: float | None
class docx_parser_converter.docx_parsers.models.table_models.TableLook(*, firstRow: bool | None = None, lastRow: bool | None = None, firstColumn: bool | None = None, lastColumn: bool | None = None, noHBand: bool | None = None, noVBand: bool | None = None)[source]

Bases: BaseModel

Represents the look settings for a table.

Example

The following is an example of a table look element in a table properties element:

<w:tblLook w:firstRow="1" w:lastRow="0" w:firstColumn="1" w:lastColumn="0" w:noHBand="0" w:noVBand="1"/>
firstColumn: bool | None
firstRow: bool | None
lastColumn: bool | None
lastRow: 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]] = {'firstColumn': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='Indicates if the first column has special formatting.'), 'firstRow': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='Indicates if the first row has special formatting.'), 'lastColumn': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='Indicates if the last column has special formatting.'), 'lastRow': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='Indicates if the last row has special formatting.'), 'noHBand': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='Indicates if horizontal banding is disabled.'), 'noVBand': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='Indicates if vertical banding is disabled.')}

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

This replaces Model.__fields__ from Pydantic V1.

noHBand: bool | None
noVBand: bool | None
class docx_parser_converter.docx_parsers.models.table_models.TableProperties(*, tblStyle: str | None = None, tblW: TableWidth | None = None, justification: str | None = None, tblInd: TableIndent | None = None, tblCellMar: MarginProperties | None = None, tblBorders: TableCellBorders | None = None, shd: ShadingProperties | None = None, tblLayout: str | None = None, tblLook: TableLook | None = None)[source]

Bases: BaseModel

Represents the properties of a table.

Example

The following is an example of table properties in a table element:

<w:tblPr>
    <w:tblStyle w:val="TableGrid"/>
    <w:tblW w:w="5000" w:type="dxa"/>
    <w:tblInd w:w="200" w:type="dxa"/>
    <w:tblBorders>...</w:tblBorders>
    <w:shd w:val="clear" w:color="auto" w:fill="FFFF00"/>
    <w:tblLayout w:type="fixed"/>
    <w:tblLook w:firstRow="1" w:lastRow="0" w:firstColumn="1" w:lastColumn="0" w:noHBand="0" w:noVBand="1"/>
</w:tblPr>
justification: 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]] = {'justification': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The justification for the table.'), 'shd': FieldInfo(annotation=Union[ShadingProperties, NoneType], required=False, default=None, description='The shading properties of the table.'), 'tblBorders': FieldInfo(annotation=Union[TableCellBorders, NoneType], required=False, default=None, description='The borders of the table.'), 'tblCellMar': FieldInfo(annotation=Union[MarginProperties, NoneType], required=False, default=None, description='The cell margins of the table.'), 'tblInd': FieldInfo(annotation=Union[TableIndent, NoneType], required=False, default=None, description='The indent of the table.'), 'tblLayout': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The layout of the table.'), 'tblLook': FieldInfo(annotation=Union[TableLook, NoneType], required=False, default=None, description='The look settings of the table.'), 'tblStyle': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The style of the table.'), 'tblW': FieldInfo(annotation=Union[TableWidth, NoneType], required=False, default=None, description='The width of the table.')}

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

This replaces Model.__fields__ from Pydantic V1.

shd: ShadingProperties | None
tblBorders: TableCellBorders | None
tblCellMar: MarginProperties | None
tblInd: TableIndent | None
tblLayout: str | None
tblLook: TableLook | None
tblStyle: str | None
tblW: TableWidth | None
class docx_parser_converter.docx_parsers.models.table_models.TableRow(*, properties: TableRowProperties | None = None, cells: List[TableCell])[source]

Bases: BaseModel

Represents a row within a table.

Example

The following is an example of a table row element:

<w:tr>
    <w:trPr>...</w:trPr>
    <w:tc>...</w:tc>
</w:tr>
cells: List[TableCell]
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]] = {'cells': FieldInfo(annotation=List[TableCell], required=True, description='The list of cells in the table row.'), 'properties': FieldInfo(annotation=Union[TableRowProperties, NoneType], required=False, default=None, description='The properties of the table row.')}

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: TableRowProperties | None
class docx_parser_converter.docx_parsers.models.table_models.TableRowProperties(*, trHeight: str | None = None, trHeight_hRule: str | None = None, tblHeader: bool | None = None, justification: str | None = None, tblBorders: TableCellBorders | None = None, shd: ShadingProperties | None = None)[source]

Bases: BaseModel

Represents the properties of a table row.

Example

The following is an example of table row properties in a table row element:

<w:trPr>
    <w:trHeight w:val="240"/>
    <w:tblHeader/>
    <w:jc w:val="center"/>
    <w:tblBorders>...</w:tblBorders>
    <w:shd w:val="clear" w:color="auto" w:fill="FFFF00"/>
</w:trPr>
justification: 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]] = {'justification': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The justification for the row content.'), 'shd': FieldInfo(annotation=Union[ShadingProperties, NoneType], required=False, default=None, description='The shading properties for the table row.'), 'tblBorders': FieldInfo(annotation=Union[TableCellBorders, NoneType], required=False, default=None, description='The borders for the table row.'), 'tblHeader': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, description='Indicates if the row is a table header.'), 'trHeight': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The height of the table row.'), 'trHeight_hRule': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The height rule for the table row.')}

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

This replaces Model.__fields__ from Pydantic V1.

shd: ShadingProperties | None
tblBorders: TableCellBorders | None
tblHeader: bool | None
trHeight: str | None
trHeight_hRule: str | None
class docx_parser_converter.docx_parsers.models.table_models.TableWidth(*, type: str | None = None, width: float | None = None)[source]

Bases: BaseModel

Represents the width of a table or table cell.

Example

The following is an example of a table width element in a table properties element:

<w:tblW w:type="dxa" w:w="5000"/>
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=Union[str, NoneType], required=False, default=None, description="The type of width (e.g., 'dxa')."), 'width': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, description='The width 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.

type: str | None
width: float | None