Hello everyone,
I would like to automate the task of retrieving the colors of pie chart slices inside an Excel (.xlsx) file. So far I tried the following approaches:
Extract the .xlsx file such that I am left with the resulting .xml files, which carry the information of the spreadsheet. I was able to find the hex codes of the six accent colors for each theme used inside the spreadsheet. The colors of the slices of pie charts inside the spreadsheet are very similar to these colors, so I assumed the colors of the pie chart slices are based on these colors. Pie charts can have more than six colors, so Excel must automatically generate new colors to fill the slices of a pie chart having more than six slices. As mentioned, I could only find the six accent colors of the theme inside the unpacked .xml files but not all the colors of all the slices. The search was conducted using a regex of hex numbers over all the unpacked .xml files.
My second approach was to google a code/formula that calculates the color of a slice in a pie chart based on the accent colors of the theme. Unfortunately, I could not find such code/ such a formula.
So given a pie chart inside an Excel (.xlsx) file I would like to either automatically read the information of the colors from somewhere or calculate the colors based on information I can automatically retrieve from the Excel file. I want to emphasize that I am not asking for the whole solution to this problem but whether and how the color information of a pie chart in an Excel file can be found without manually looking them up inside Excel.
Any help or ideas are appreciated.
Thank you
Bookmarks