scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.36k stars 511 forks source link

Data Labels Background Color #662

Open Akshat12071207 opened 3 years ago

Akshat12071207 commented 3 years ago

Is there any functionality that supports to add background fill to DATA_LABELS for a Line_Chart?

For other stuff there is an option of xyz.format.fill.solid

However, I couldn't see the option of format in Data_Labels.

Is there any way around

@scanny

danielharpernz commented 11 months ago

I was also looking at changing the fill for the data_labels but don't believe it is possible. Would love to be mistaken however. Also an option to add leader lines and other label options from "format data labels"

scanny commented 11 months ago

Can you do it by hand in PowerPoint? If so then the XML format supports it. There's unlikely to be a feature added to python-pptx for this until someone wants it bad enough to sponsor it, but that doesn't mean you can't find a way to adjust the XML to implement this if you're willing to dive into the XML details.

If you can do it by hand then you can inspect before and after XML to discover the changes required, and then add the required elements using the lxml API (python-pptx is based on lxml for XML processing).