Represent the slide page in text.
(self, show_image: bool = False)
| 1123 | return "\n".join([shape.to_pptc() for shape in self.shapes]) |
| 1124 | |
| 1125 | def to_text(self, show_image: bool = False) -> str: |
| 1126 | """ |
| 1127 | Represent the slide page in text. |
| 1128 | """ |
| 1129 | text_content = "\n".join( |
| 1130 | [ |
| 1131 | shape.text_frame.text.strip() |
| 1132 | for shape in self.shapes |
| 1133 | if shape.text_frame.is_textframe |
| 1134 | ] |
| 1135 | ) |
| 1136 | if show_image: |
| 1137 | for image in self.shape_filter(Picture): |
| 1138 | if not image.caption: |
| 1139 | raise ValueError( |
| 1140 | f"caption not found for picture {image.shape_idx} of slide {image.slide_idx}" |
| 1141 | ) |
| 1142 | text_content += "\n" + "Image: " + image.caption |
| 1143 | return text_content |
| 1144 | |
| 1145 | @property |
| 1146 | def text_length(self): |
no test coverage detected