docx_parser_converter.docx_parsers.tables.table_row_properties_parser module
- class docx_parser_converter.docx_parsers.tables.table_row_properties_parser.TableRowPropertiesParser[source]
Bases:
objectA parser for extracting table row properties from an XML element.
- static extract_justification(element: Element | None) str | None[source]
Extracts justification from the given XML element.
- Parameters:
element (Optional[etree.Element]) – The XML element.
- Returns:
The justification, or None if not found.
- Return type:
Optional[str]
Example
The following is an example of a justification element:
<w:jc w:val="center"/>
- static extract_row_height(element: Element | None) str | None[source]
Extracts row height from the given XML element.
- Parameters:
element (Optional[etree.Element]) – The XML element.
- Returns:
The row height in points as a string, or None if not found.
- Return type:
Optional[str]
Example
The following is an example of a row height element:
<w:trHeight w:val="300"/>
- static extract_row_height_h_rule(element: Element | None) str | None[source]
Extracts row height rule from the given XML element.
- Parameters:
element (Optional[etree.Element]) – The XML element.
- Returns:
The row height rule, or None if not found.
- Return type:
Optional[str]
Example
The following is an example of a row height rule element:
<w:trHeight w:val="300" w:hRule="exact"/>
- static extract_table_header(element: Element | None) bool | None[source]
Extracts table header from the given XML element.
- Parameters:
element (Optional[etree.Element]) – The XML element.
- Returns:
True if the table header is found, otherwise None.
- Return type:
Optional[bool]
Example
The following is an example of a table header element:
<w:tblHeader/>
- static parse(trPr_element: Element | None) TableRowProperties[source]
Parses table row properties from the given XML element.
- Parameters:
trPr_element (Optional[etree.Element]) – The row properties XML element.
- Returns:
The parsed table row properties.
- Return type:
Example
The following is an example of table row properties in a table row element:
<w:trPr> <w:trHeight w:val="300"/> <w:tblHeader/> <w:jc w:val="center"/> <w:tblBorders> <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:tblBorders> <w:shd w:val="clear" w:color="auto" w:fill="FFFF00"/> </w:trPr>