Spaces:
Sleeping
Sleeping
Update ppt_parser.py
Browse files- ppt_parser.py +1 -4
ppt_parser.py
CHANGED
@@ -65,7 +65,6 @@ def transfer_to_structure(pptx_file, images_dir_path):
|
|
65 |
for j, shape in enumerate(slide.shapes):
|
66 |
shape_item = {}
|
67 |
|
68 |
-
# Case 1: Normal text box
|
69 |
if shape.has_text_frame:
|
70 |
shape_item['type'] = "text"
|
71 |
text_frame = shape.text_frame
|
@@ -74,12 +73,10 @@ def transfer_to_structure(pptx_file, images_dir_path):
|
|
74 |
if data:
|
75 |
shape_item[f'paragraph_{r}'] = data
|
76 |
|
77 |
-
# Case 2: Grouped shapes
|
78 |
elif isinstance(shape, GroupShape):
|
79 |
shape_item['type'] = "group"
|
80 |
shape_item['group_content'] = transfer_textbox_content_in_group(shape)
|
81 |
|
82 |
-
# Case 3: Picture
|
83 |
elif isinstance(shape, Picture):
|
84 |
shape_item['type'] = "picture"
|
85 |
image_path = os.path.join(images_dir_path, f"picture_{j}.png")
|
@@ -94,7 +91,7 @@ def transfer_to_structure(pptx_file, images_dir_path):
|
|
94 |
shape_image = Image.open(image_stream)
|
95 |
shape_image.save(image_path)
|
96 |
except Exception:
|
97 |
-
pass
|
98 |
|
99 |
slide_item[f"shape_{j}"] = shape_item
|
100 |
|
|
|
65 |
for j, shape in enumerate(slide.shapes):
|
66 |
shape_item = {}
|
67 |
|
|
|
68 |
if shape.has_text_frame:
|
69 |
shape_item['type'] = "text"
|
70 |
text_frame = shape.text_frame
|
|
|
73 |
if data:
|
74 |
shape_item[f'paragraph_{r}'] = data
|
75 |
|
|
|
76 |
elif isinstance(shape, GroupShape):
|
77 |
shape_item['type'] = "group"
|
78 |
shape_item['group_content'] = transfer_textbox_content_in_group(shape)
|
79 |
|
|
|
80 |
elif isinstance(shape, Picture):
|
81 |
shape_item['type'] = "picture"
|
82 |
image_path = os.path.join(images_dir_path, f"picture_{j}.png")
|
|
|
91 |
shape_image = Image.open(image_stream)
|
92 |
shape_image.save(image_path)
|
93 |
except Exception:
|
94 |
+
pass
|
95 |
|
96 |
slide_item[f"shape_{j}"] = shape_item
|
97 |
|