openpyxl 中有一个 openpyxl.chart.chartspace.DataTable
类,但没有示例。当我尝试使用它时,我得到:
AttributeError: 'BarChart' object has no attribute 'DataTable'
或者我无法使用以下代码在图表空间中获取数据表:
from openpyxl.chart.chartspace import DataTable
chart1 = BarChart()
chart1.DataTable = DataTable(showHorzBorder=None , showVertBorder=None,showOutline=None, showKeys=None, spPr=None,txPr=None, extLst=None)
最佳答案
也许为时已晚..这对我有用
from openpyxl.chart.plotarea import DataTable
chart1 = BarChart()
chart1.plot_area.dTable = DataTable()
chart1.plot_area.dTable.showHorzBorder = True
chart1.plot_area.dTable.showVertBorder = True
chart1.plot_area.dTable.showOutline = True
chart1.plot_area.dTable.showKeys = True
关于python - 如何使用 openpyxls 将数据表添加到图表空间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44143123/