使用 openpyxl,插入到我的工作表中的图表有边框。有没有办法通过 styles.Style/styles.borders 模块将图表(饼图/条形图)的样式设置为没有边框,或者至少设置一个细白色边框,以便它们可以无边框打印?
我在该对象上看到的唯一选项是 .style = <int>
这似乎实际上并没有影响最终图形的设计。
最佳答案
可以设置聊天的graphical_properties,代码为
chart.graphical_properties = GraphicalProperties(ln=LineProperties(noFill=True))
这会将线条样式应用于图表空间。
在执行此操作之前,您应该修改openpyxl lib
的源代码,该文件为
Python27\Lib\site-packages\openpyxl\chart\_chart.py
#cs = ChartSpace(chart=container)
cs = ChartSpace(chart=container, spPr=self.graphical_properties)
效果很好。
关于python - openpyxl - 能够从图表中删除边框吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36988384/