scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.35k stars 510 forks source link

Changes data_labels.position causes slide corruption #789

Open MBRGA opened 2 years ago

MBRGA commented 2 years ago

The following code causes Powerpoint to detect a corrupt slide:

dl = chart.plots[0].data_labels
dl.position = XL_LABEL_POSITION.OUTSIDE_END

It doesn't seem to be dependent on which enum value I use. Everything else I'm doing seems to be fine, so I don't think it's a problem with how I'm creating the chart.

Adding the data labels works fine so long as I don't try to change the position

MBRGA commented 2 years ago

Actually looks like this might be a limitation of the chart type. I'm using a stacked column chart and it looks like some of the enum values (the ones I tried) aren't supported. Perhaps it would be good to raise an exception?

mszbot commented 2 years ago

The error you got is the correct exception.