Editing Underlying Powerpoint Xml With Python (python-pptx)
I have PowerPoint files with many dozens of links to different sheets in an Excel document. I need to change the Excel documents to which these links point in a programmatic way.
Solution 1:
Try setting the ._target
attribute of the rel
(Relationship) object
https://github.com/scanny/python-pptx/blob/master/pptx/opc/package.py#L555
rel._target = 'FULL_PATH_OMITTED\test.xlsx!Sheet1!R3C5:R20C14'
This will only work when the relationship type is External (as opposed to a relationship to another part in the same package).
This is hacking internals, of course, so use at your own risk. That said, this part of the code base has been very stable for a long time.
Post a Comment for "Editing Underlying Powerpoint Xml With Python (python-pptx)"