scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.26k stars 499 forks source link

replicate chart created by hand #919

Closed Deusdeorum closed 8 months ago

Deusdeorum commented 8 months ago

I would post this question in the "discussion" section of this repository, but sadly, there's no discussion tab in this repository. For now, I have only used python-pptx to replace data in the charts so that the chart itself gets styled exactly how I want it to be styled beforehand.

However, let's consider a scenario where I have a stacked100 chart styled manually. Is it possible to replicate the chart with python-pptx so that it is identical to how I styled it in the GUI?

I'm not asking how to do it. I'm only asking if, in theory, it is possible.

MartinPacker commented 8 months ago

It's hard to be 100% without trying it. And perhaps some tweaking of the XML is needed to get you all the way there.

What have your experiments shown so far?

scanny commented 8 months ago

If Stacked-100 is an option in python-pptx then I expect you could get quite close, possibly exactly, maybe needing to do a few XML patches if your formatting is fancy.

If Stacked-100 is not an option there's probably a reason and then I'd be less optimistic. But it's all XML underneath so depending on your skill and desire anything is possible.

Like @MartinPacker says, the best answer is going to come from trying it, but overall I'd start with optimism :)