Return a newly created paragraph, inserted directly before this paragraph. If `text` is supplied, the new paragraph contains that text in a single run. If `style` is provided, that style is assigned to the new paragraph.
(
self, text: str | None = None, style: str | ParagraphStyle | None = None
)
| 77 | return [Hyperlink(hyperlink, self) for hyperlink in self._p.hyperlink_lst] |
| 78 | |
| 79 | def insert_paragraph_before( |
| 80 | self, text: str | None = None, style: str | ParagraphStyle | None = None |
| 81 | ) -> Paragraph: |
| 82 | """Return a newly created paragraph, inserted directly before this paragraph. |
| 83 | |
| 84 | If `text` is supplied, the new paragraph contains that text in a single run. If |
| 85 | `style` is provided, that style is assigned to the new paragraph. |
| 86 | """ |
| 87 | paragraph = self._insert_paragraph_before() |
| 88 | if text: |
| 89 | paragraph.add_run(text) |
| 90 | if style is not None: |
| 91 | paragraph.style = style |
| 92 | return paragraph |
| 93 | |
| 94 | def iter_inner_content(self) -> Iterator[Run | Hyperlink]: |
| 95 | """Generate the runs and hyperlinks in this paragraph, in the order they appear. |