Paragraph object. Not intended to be constructed directly.
| 465 | |
| 466 | |
| 467 | class _Paragraph(Subshape): |
| 468 | """Paragraph object. Not intended to be constructed directly.""" |
| 469 | |
| 470 | def __init__(self, p: CT_TextParagraph, parent: ProvidesPart): |
| 471 | super(_Paragraph, self).__init__(parent) |
| 472 | self._element = self._p = p |
| 473 | |
| 474 | def add_line_break(self): |
| 475 | """Add line break at end of this paragraph.""" |
| 476 | self._p.add_br() |
| 477 | |
| 478 | def add_run(self) -> _Run: |
| 479 | """Return a new run appended to the runs in this paragraph.""" |
| 480 | r = self._p.add_r() |
| 481 | return _Run(r, self) |
| 482 | |
| 483 | @property |
| 484 | def alignment(self) -> PP_PARAGRAPH_ALIGNMENT | None: |
| 485 | """Horizontal alignment of this paragraph. |
| 486 | |
| 487 | The value |None| indicates the paragraph should 'inherit' its effective value from its |
| 488 | style hierarchy. Assigning |None| removes any explicit setting, causing its inherited |
| 489 | value to be used. |
| 490 | """ |
| 491 | return self._pPr.algn |
| 492 | |
| 493 | @alignment.setter |
| 494 | def alignment(self, value: PP_PARAGRAPH_ALIGNMENT | None): |
| 495 | self._pPr.algn = value |
| 496 | |
| 497 | def clear(self): |
| 498 | """Remove all content from this paragraph. |
| 499 | |
| 500 | Paragraph properties are preserved. Content includes runs, line breaks, and fields. |
| 501 | """ |
| 502 | for elm in self._element.content_children: |
| 503 | self._element.remove(elm) |
| 504 | return self |
| 505 | |
| 506 | @property |
| 507 | def font(self) -> Font: |
| 508 | """|Font| object containing default character properties for the runs in this paragraph. |
| 509 | |
| 510 | These character properties override default properties inherited from parent objects such |
| 511 | as the text frame the paragraph is contained in and they may be overridden by character |
| 512 | properties set at the run level. |
| 513 | """ |
| 514 | return Font(self._defRPr) |
| 515 | |
| 516 | @property |
| 517 | def level(self) -> int: |
| 518 | """Indentation level of this paragraph. |
| 519 | |
| 520 | Read-write. Integer in range 0..8 inclusive. 0 represents a top-level paragraph and is the |
| 521 | default value. Indentation level is most commonly encountered in a bulleted list, as is |
| 522 | found on a word bullet slide. |
| 523 | """ |
| 524 | return self._pPr.lvl |
no outgoing calls
searching dependent graphs…