2

I am trying to create PowerPoint presentations with python-pptx and currently I am trying to create shapes and connectors in a for loop. Even though the Connector is created and it does connect to shapes, it looks unnatural when I open the presentation itself, kinda like it's rotated. However, as soon as as I move the top of the shapes, its starts to look as expected.

I've tried reading documentation (https://python-pptx.readthedocs.io/en/latest/api/shapes.html#connector-objects) but I don't see any option that changes the way Connector "looks".

Some of the code:

top_shape = shapes.add_shape(MSO_SHAPE.RECTANGLE, Inches(2), Inches(1), width, height)
    for i in range(8):
    bottom_shape = shapes.add_shape(MSO_SHAPE.RECTANGLE, left, top, width, height)
    connector = shapes.add_connector(MSO_CONNECTOR.ELBOW, Cm(1), Cm(1), Cm(1), Cm(1))
    connector.begin_connect(top_shape, 2)
    connector.end_connect(bottom_shape, 0)
prs.save('test.pptx')

I expect it to look like here: https://support.office.com/en-us/article/reroute-or-move-connectors-between-shapes-da6a1212-927b-4473-967d-484182f47b3f

Here is how the presentation looks like

It seems it like, the "elbow" part is created in the 'horizontal' middle, rather than vertical. Is there any way to change how the elbow line looks like?

  • Was this issue solved? Would appreciate your guidance if so. Thanks! – Rami.K Jul 09 '20 at 01:45
  • 1
    @Rami.K Hi! Actually no, not with this library, I eventually stopped trying. I was however more successful with using pptxgenjs library for JavaScript. The library itself doesnt support all connector shapes, but I modified it for my usage and was able to create Connectors as they should look. In case this is an appropriate solution for you, I might find what I changed to make it work in my single case. – One-Two One Jul 22 '20 at 09:26

0 Answers0