如何在我的Excel饼图上创建自定义颜色? 我的饼图有5个切片。以下是我的源代码。c#Excel饼图自定义颜色
using Excel = Microsoft.Office.Interop.Excel;
Excel.Range chartRange;
Excel.ChartObjects xlCharts = (Excel.ChartObjects)xlWorkSheet.ChartObjects(Type.Missing);
Excel.ChartObject myChart = (Excel.ChartObject)xlCharts.Add(10, 80, 500, 350);
Excel.Chart chartPage = myChart.Chart;
chartRange = xlWorkSheet.get_Range("A3", "B7");
chartPage.ChartStyle = 209;
chartPage.HasTitle = true;
chartPage.ChartTitle.Text = "HeaderText Title";
chartPage.SetSourceData(chartRange, misValue);
chartPage.ChartType = Excel.XlChartType.xl3DPieExploded;
chartPage.Elevation = 35;
chartPage.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowLabelAndPercent ,false, true, true, false, true, false, true, true, Separator:System.Environment.NewLine);
xlWorkBook.SaveAs(saveAsLocation);
xlWorkBook.Close(true, misValue, misValue);
xlApp.Quit();
有人可以给你的最佳建议不一定是鱼,但如何将记录的宏转换为C#来为生活寻找答案:https://blogs.msdn.microsoft.com/csharpfaq/2010/09/27 /转换为a-vba-macro-to-c-4-0/ –