MCPcopy Index your code
hub / github.com/python-openxml/python-docx / _cells

Method _cells

src/docx/table.py:164–180  ·  view source on GitHub ↗

A sequence of |_Cell| objects, one for each cell of the layout grid. If the table contains a span, one or more |_Cell| object references are repeated.

(self)

Source from the content-addressed store, hash-verified

162
163 @property
164 def _cells(self) -> list[_Cell]:
165 """A sequence of |_Cell| objects, one for each cell of the layout grid.
166
167 If the table contains a span, one or more |_Cell| object references are
168 repeated.
169 """
170 col_count = self._column_count
171 cells: list[_Cell] = []
172 for tc in self._tbl.iter_tcs():
173 for grid_span_idx in range(tc.grid_span):
174 if tc.vMerge == ST_Merge.CONTINUE:
175 cells.append(cells[-col_count])
176 elif grid_span_idx > 0:
177 cells.append(cells[-1])
178 else:
179 cells.append(_Cell(tc, self))
180 return cells
181
182 @property
183 def _column_count(self):

Callers

nothing calls this directly

Calls 3

_CellClass · 0.85
iter_tcsMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected