MCPcopy Create free account
hub / github.com/scanny/python-pptx / _Cell

Class _Cell

src/pptx/table.py:168–378  ·  view source on GitHub ↗

Table cell

Source from the content-addressed store, hash-verified

166
167
168class _Cell(Subshape):
169 """Table cell"""
170
171 def __init__(self, tc: CT_TableCell, parent: ProvidesPart):
172 super(_Cell, self).__init__(parent)
173 self._tc = tc
174
175 def __eq__(self, other: object) -> bool:
176 """|True| if this object proxies the same element as `other`.
177
178 Equality for proxy objects is defined as referring to the same XML element, whether or not
179 they are the same proxy object instance.
180 """
181 if not isinstance(other, type(self)):
182 return False
183 return self._tc is other._tc
184
185 def __ne__(self, other: object) -> bool:
186 if not isinstance(other, type(self)):
187 return True
188 return self._tc is not other._tc
189
190 @lazyproperty
191 def fill(self) -> FillFormat:
192 """|FillFormat| instance for this cell.
193
194 Provides access to fill properties such as foreground color.
195 """
196 tcPr = self._tc.get_or_add_tcPr()
197 return FillFormat.from_fill_parent(tcPr)
198
199 @property
200 def is_merge_origin(self) -> bool:
201 """True if this cell is the top-left grid cell in a merged cell."""
202 return self._tc.is_merge_origin
203
204 @property
205 def is_spanned(self) -> bool:
206 """True if this cell is spanned by a merge-origin cell.
207
208 A merge-origin cell "spans" the other grid cells in its merge range, consuming their area
209 and "shadowing" the spanned grid cells.
210
211 Note this value is |False| for a merge-origin cell. A merge-origin cell spans other grid
212 cells, but is not itself a spanned cell.
213 """
214 return self._tc.is_spanned
215
216 @property
217 def margin_left(self) -> Length:
218 """Left margin of cells.
219
220 Read/write. If assigned |None|, the default value is used, 0.1 inches for left and right
221 margins and 0.05 inches for top and bottom.
222 """
223 return self._tc.marL
224
225 @margin_left.setter

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…