简体   繁体   中英

How to use python-pptx to replace specific categories in the chart

Currently, I am doing repeated work like find and replace some content in PowerPoint. And I find some codes to F&R the text in the text-box or table. However, I cannot F&R those words in the chart that I need to edit in excel. Is there any possible solution? Instead of extracting the data to create a new chart.

Charts in Powerpoint are a little tricky, as they are stored in two places.

You'll need to first edit the "real" chart data by loading the excel behind (in C# this is the EmbeddedData section), and then update the cached values that Powerpoint has. These are descendants of the chartspace. If you don't do this, then you have to click in and out of the slide deck to trick Powerpoint into updating. I'm afraid I don't have python code to do that as I did the same in C#/Dotnet for slidetemplater.com

That does however have a python API too ( https://pypi.org/project/slidetemplater/ )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM