|
43 | 43 | from .datatype import Boolean, Date, DateTime, Duration |
44 | 44 | from .element import ( |
45 | 45 | Element, |
| 46 | + EText, |
46 | 47 | register_element_class, |
47 | 48 | xpath_compile, |
48 | 49 | xpath_return_elements, |
|
63 | 64 | ) |
64 | 65 |
|
65 | 66 | if TYPE_CHECKING: |
66 | | - from .element import EText |
67 | 67 | from .style import Style |
68 | 68 |
|
69 | 69 | _XP_ROW = xpath_compile( |
@@ -637,15 +637,11 @@ def protection_key(self, key: str) -> None: |
637 | 637 |
|
638 | 638 | @property |
639 | 639 | def printable(self) -> bool: |
640 | | - printable = self.get_attribute("table:print") |
641 | | - # Default value |
642 | | - if printable is None: |
643 | | - return True |
644 | | - return bool(printable) |
| 640 | + return self._get_attribute_bool_default("table:print", True) |
645 | 641 |
|
646 | 642 | @printable.setter |
647 | 643 | def printable(self, printable: bool) -> None: |
648 | | - self.set_attribute("table:print", printable) |
| 644 | + self._set_attribute_bool_default("table:print", printable, True) |
649 | 645 |
|
650 | 646 | @property |
651 | 647 | def print_ranges(self) -> list[str]: |
@@ -759,7 +755,7 @@ def iter_values( |
759 | 755 |
|
760 | 756 | Filter by coordinates will parse the area defined by the coordinates. |
761 | 757 |
|
762 | | - cell_type, complete, grt_type : see get_values() |
| 758 | + cell_type, complete, get_type : see get_values() |
763 | 759 |
|
764 | 760 |
|
765 | 761 |
|
@@ -891,11 +887,9 @@ def rstrip(self, aggressive: bool = False) -> None: |
891 | 887 | self._table_cache.clear_row_indexes() |
892 | 888 | # Step 3: trim columns to match max_width |
893 | 889 | columns = self._get_columns() |
894 | | - repeated_cols: list[EText] = self.xpath( # type: ignore[assignment] |
895 | | - "table:table-column/@table:number-columns-repeated" |
| 890 | + repeated_cols: list[EText] = cast( |
| 891 | + list[EText], self.xpath("table:table-column/@table:number-columns-repeated") |
896 | 892 | ) |
897 | | - if not isinstance(repeated_cols, list): |
898 | | - raise TypeError |
899 | 893 | unrepeated = len(columns) - len(repeated_cols) |
900 | 894 | column_width = sum(int(r) for r in repeated_cols) + unrepeated |
901 | 895 | diff = column_width - max_width |
|
0 commit comments