python-pptx icon indicating copy to clipboard operation
python-pptx copied to clipboard

how to get the `connector_type` of a `Connector`

Open Force1ess opened this issue 6 months ago • 0 comments

Hi, I'm trying to reproduce shapes in a PPTX file, but I'm encountering an issue with connectors.

Specifically, it seems that the connector type is defined within an XML tag, as shown in the src/pptx/oxml/shapes/connector.py: 64 file:

f'    <a:prstGeom prst="{prst}">\n'

However, in the actual slide XML for a connector, the XML structure looks like this:

self._element.spPr.prstGeom.xml

'<a:prstGeom xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" prst="straightConnector1">\n  <a:avLst/>\n</a:prstGeom>\n'

It appears that the prst attribute in the a:prstGeom tag is crucial for defining the connector type.

This issue seems related to #749, where shape.element.spPr.prstGeom.xml.prst is also causing similar problems.

Could you provide guidance on how to correctly handle this connector type in the XML, or if there's a workaround for this issue?

Thanks!

Force1ess avatar Aug 21 '24 04:08 Force1ess