wb = excel.Workbooks.Open(f"C:\\Users\\user\\Downloads\\EXCEL\\Credits_Query.xlsx")
ws=wb.Sheets("OEM Pivot")
chart = ws.ChartObjects(1).Chart
chart.SeriesCollection(1).XValues
返回:(“NTK 553 FAE 5”、“8DG 62496 AA”、“TOM-100 G-Q-LR 4”、“ORM-CXH 1”等)
chart.SeriesCollection(1).Points(1).Fill.ForeColor.RGB
退货数量:39423
但它似乎是只读的。
>>> chart.SeriesCollection(1).Points(1).Fill.ForeColor.RGB = 50
Traceback (most recent call last):
File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\win32com\client\__init__.py", line 590, in __setattr__
args, defArgs = self._prop_map_put_[attr]
KeyError: 'RGB'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\jepal\AppData\Roaming\Python\Python39\site-packages\win32com\client\__init__.py", line 592, in __setattr__
raise AttributeError(
AttributeError: '<win32com.gen_py.Microsoft Excel 16.0 Object Library.ChartColorFormat
instance at 0x2231402656864>' object has no attribute 'RGB'
我还试了几种变体:图表.系列集合(1).点(1).填充.前景色. RGB.设置属性
但是运气不好,有没有可能改变数据点的颜色?
1条答案
按热度按时间uklbhaso1#
像往常一样,几个小时的研究没有运气,和2分钟后,我张贴我找到了答案。
这可让您变更个别点的颜色。