The `tc` element in this tr at exact `grid offset`. Raises ValueError when this `w:tr` contains no `w:tc` with exact starting `grid_offset`.
(self, grid_offset: int)
| 77 | return trPr.grid_before |
| 78 | |
| 79 | def tc_at_grid_offset(self, grid_offset: int) -> CT_Tc: |
| 80 | """The `tc` element in this tr at exact `grid offset`. |
| 81 | |
| 82 | Raises ValueError when this `w:tr` contains no `w:tc` with exact starting `grid_offset`. |
| 83 | """ |
| 84 | # -- account for omitted cells at the start of the row -- |
| 85 | remaining_offset = grid_offset - self.grid_before |
| 86 | |
| 87 | for tc in self.tc_lst: |
| 88 | # -- We've gone past grid_offset without finding a tc, no sense searching further. -- |
| 89 | if remaining_offset < 0: |
| 90 | break |
| 91 | # -- We've arrived at grid_offset, this is the `w:tc` we're looking for. -- |
| 92 | if remaining_offset == 0: |
| 93 | return tc |
| 94 | # -- We're not there yet, skip forward the number of layout-grid cells this cell |
| 95 | # -- occupies. |
| 96 | remaining_offset -= tc.grid_span |
| 97 | |
| 98 | raise ValueError(f"no `tc` element at grid_offset={grid_offset}") |
| 99 | |
| 100 | @property |
| 101 | def tr_idx(self) -> int: |
no outgoing calls