openpyxl - Ability to remove border from charts?

后端 未结 2 1857
慢半拍i
慢半拍i 2021-01-23 20:26

Using openpyxl, the charts inserted into my worksheet have a border on them. Is there any way to set the style of the chart (pie/bar) to either via the styles.Style/styles.bord

相关标签:
2条回答
  • 2021-01-23 20:52

    You can set chat graphical_properties, the code is

    chart.graphical_properties = GraphicalProperties(ln=LineProperties(noFill=True))
    

    This will apply the line style to chartSpace. Before you do this, you should modifiy the source code of openpyxl lib, the file is

    Python27\Lib\site-packages\openpyxl\chart\_chart.py
        #cs = ChartSpace(chart=container)
        cs = ChartSpace(chart=container, spPr=self.graphical_properties)
    

    It works well.

    0 讨论(0)
  • 2021-01-23 21:02

    This isn't easy but should be possible. You will need to work through the XML source of a suitably formatted sample chart and see which particular variables need setting or changing. openpyxl implements the complete chart API but this unfortunately very complicated.

    0 讨论(0)
提交回复
热议问题