bug fix to ensure handling of pictures only applies to picture with an image attribute and image part of all extensions except with emf or wmf extensions to avoid bug in adding picture to doc

This commit is contained in:
Benichou 2025-03-30 15:50:24 -04:00
parent 44f2b081ec
commit fbc4c4d103

View File

@ -392,9 +392,10 @@ class MsPowerpointDocumentBackend(DeclarativeDocumentBackend, PaginatedDocumentB
self.handle_tables(shape, parent_slide, slide_ind, doc, slide_size) self.handle_tables(shape, parent_slide, slide_ind, doc, slide_size)
if shape.shape_type == MSO_SHAPE_TYPE.PICTURE: if shape.shape_type == MSO_SHAPE_TYPE.PICTURE:
# Handle Pictures # Handle Pictures
self.handle_pictures( if hasattr(shape, "image"): # make sure the Picture shape has an image attribute
shape, parent_slide, slide_ind, doc, slide_size image_part = shape.image
) if image_part.ext not in ["emf", "wmf"]: # all extensions except emf and wmf that lead to bug in adding picture to doc
self.handle_pictures(shape, parent_slide, slide_ind, doc, slide_size)
# If shape doesn't have any text, move on to the next shape # If shape doesn't have any text, move on to the next shape
if not hasattr(shape, "text"): if not hasattr(shape, "text"):
return return