scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.39k stars 518 forks source link

Add OLE shapes #981

Open R3c4rdo opened 4 months ago

R3c4rdo commented 4 months ago

Hello,

I am trying to add different OLE objects into a pptx and I noticed that for example if i use the "standard" way of adding a new xlsx for example:

slide.shapes.add_ole_object( object_file='../Test.xlsx', prog_id=PROG_ID.XLSX, left=self.left, top=self.top )

This works flawlessly. But if I try to use the prog_id as a string for example:

slide.shapes.add_ole_object( object_file='../Test.xlsx', prog_id="Excel.Sheet.12", left=self.left, top=self.top, )

an empty excel file object is embedded into the pptx. Is there a way to overcome this? I was trying to use different file objects like pdf files and the behavior seems to be the same as the second example where an empty pdf file is embedded. I have tried modified the _ProgIdEnum class with a new lazyproperty for PDF but that just gives me an error.

Could you help me?

Thanks alot!