-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connector between shape doesn't match how powerpoint would draw it manually #946
Comments
Hmm, dunno. I think you'd have to analyze the change to the XML that happened between the before and after XML for the connector. Might be worth trying it for two rectangles where it comes out of a side and goes into a side of the other or out of the bottom of one and into the top of the other, just to see if that works. I think you're right the initial location of the connector endpoints is arbitrary if you're going to connect it. I don't recall much about this feature, I expect it was sponsored and this was good enough behavior for the sponsor and better-than-nothing behavior for everyone else :) I kind of suppose there is some "egress vector/angle/orientation" attribute that appears on either the connector or the shape and is not or cannot reliably be computed by |
I've tried a bunch of entry ids (0 through 3) and the end always wants to go down, then bend right. Not sure. Forgive the formatting, but here's the extracted connector info (I ditched the <style> part) to show the difference. In both cases I'm connecting from the top (0) to left side (1). As exported from python-pptx
After tweaking one side of the connector and it 'fixes' itself
I'm pretty out of my depth here on how one could fix this, but at least this gives some data that might be helpful.
Ha! Perfectly said, and understood :) Thanks for taking a look. |
Ah, okay, so definitely the There's not much out there on those, just that the python-pptx/lab/parse_xsd/xsd/dml-main.xsd Line 1956 in d043334
I think you'd be reduced to experimentation to sort out how those behave in this case. Good news is there is some interface for it in python-pptx/pptx/shapes/autoshape.py Line 19 in d043334
and docs here: https://python-pptx.readthedocs.io/en/latest/user/autoshapes.html#adjusting-an-autoshape Haven't looked at that part of the docs for a long time, looks like when I wrote it I knew more about it than I now remember :) |
Actually, reading that part of the docs more closely, the example there seems like a close fit for what you're trying to do, worth a read I'd say :) |
@jwhendy did you figure this out? it seems that the adjustments property doesn't apply to connectors? |
@Ozymansour : I think I gave up, sorry :( I did take a moment to revisit this, but am not getting @scanny 's suggestion to work. Referring to my repro code in the first post and the input on using adjustments, I assumed I should do this:
I get an error, however:
At that point I'm stumped, as the |
Caveat: I'm pretty new to python-pptx and could be easily messing up.
I approached connecting shapes naively, per the approach in this SO post answered by @scanny .
I have this image saved as
box.png
:Here is my code:
I'm getting the right connection points, but I don't understand why the connector comes in from the right vs. down?
If I go to re-connect the line manually, it does the expected thing, and I'm not sure how I could force the as-is behavior from within powerpoint even if I wanted to?
Is this a bug or user error on my part? I admit I just put in dummy coordinates; it was not clear to me why I need to initialize the coordinates of a connector when we'll just be accessing shape built-ins to accomplish this. I did play with them a bit, but saw no effect. Just in case, I implemented the method of also determining the connection points from that same SO post and tried this with the same result:
I do see that connectors are experimental, so if that's why this isn't perfect, could the docs be updated to say what, exactly, isn't working how you want? At the moment, it just seems like it only works with certain shapes, and I believe I'm using ones that ShouldWork. Thanks for any input!
The text was updated successfully, but these errors were encountered: