scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.4k stars 520 forks source link

'list' object has no attribute 'depth' #876

Open GVKGOMBER opened 1 year ago

GVKGOMBER commented 1 year ago

Using same Code which is mentioned over Python PPTX working with Charts, however showing Error 'list' object has no attribute 'depth'

See below Codes from pptx import Presentation from pptx.chart.data import CategoryChartData from pptx.enum.chart import XL_CHART_TYPE from pptx.util import Inches

create presentation with 1 slide ------

prs = Presentation() slide = prs.slides.add_slide(prs.slide_layouts[5])

define chart data ---------------------

chart_data = CategoryChartData() chart_data.categories = ['East', 'West', 'Midwest'] chart_data.add_series('Series 1', (19.2, 21.4, 16.7))

add chart to slide --------------------

x, y, cx, cy = Inches(2), Inches(2), Inches(6), Inches(4.5) slide.shapes.add_chart( XL_CHART_TYPE.COLUMN_CLUSTERED, x, y, cx, cy, chart_data )

prs.save('chart-01.pptx'