(self, shape: BaseShape, level: int)
| 107 | |
| 108 | class TextFrame: |
| 109 | def __init__(self, shape: BaseShape, level: int): |
| 110 | if not shape.has_text_frame: |
| 111 | self.is_textframe = False |
| 112 | return |
| 113 | self.paragraphs = [ |
| 114 | Paragraph(paragraph, idx) |
| 115 | for idx, paragraph in enumerate(shape.text_frame.paragraphs) |
| 116 | ] |
| 117 | para_offset = 0 |
| 118 | for para in self.paragraphs: |
| 119 | if para.idx == -1: |
| 120 | para_offset += 1 |
| 121 | else: |
| 122 | para.idx = para.idx - para_offset |
| 123 | if len(self.paragraphs) == 0: |
| 124 | self.is_textframe = False |
| 125 | return |
| 126 | self.level = level |
| 127 | self.text = shape.text |
| 128 | self.is_textframe = True |
| 129 | self.font = merge_dict( |
| 130 | object_to_dict(shape.text_frame.font), |
| 131 | [para.font for para in self.paragraphs if para.idx != -1], |
| 132 | ) |
| 133 | |
| 134 | def to_html(self, style_args: StyleArg): |
| 135 | """ |
nothing calls this directly
no test coverage detected