如何在我的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/ –