【发布时间】:2011-08-14 05:30:55
【问题描述】:
我正在尝试将图表系列的线条颜色更改为无。我尝试设置颜色和标记属性,但程序出错。
我的代码:
Excel.ChartObjects _ChartObjects = (Excel.ChartObjects)(oSheet1.ChartObjects(Missing.Value));
Excel.ChartObject _ChartObject = _ChartObjects.Add(170, 0, 400, 300);
Excel.Chart _Chart = _ChartObject.Chart;
Excel.Range oRng1;
oRng1 = oSheet1.get_Range("A1","E55");
_Chart.SetSourceData(oRng1, Excel.XlRowCol.xlColumns);
_Chart.ChartType = Microsoft.Office.Interop.Excel.XlChartType.xlLineMarkers;
oWB.ShowPivotChartActiveFields = true;
//_Chart.ChartTitle.Font.Size = 12;
_Chart.SetElement(Microsoft.Office.Core.MsoChartElementType.msoElementDataTableWithLegendKeys);
_Chart.DataTable.Font.Size = 6;
oWB.ShowPivotChartActiveFields = false;
_Chart.SetElement(Microsoft.Office.Core.MsoChartElementType.msoElementPrimaryValueAxisTitleRotated);
_Chart.SetElement(Microsoft.Office.Core.MsoChartElementType.msoElementLegendNone);
//_Chart.Legend.Delete();
_Chart.SetElement(Microsoft.Office.Core.MsoChartElementType.msoElementPrimaryValueAxisTitleNone);
_Chart.Location(Excel.XlChartLocation.xlLocationAsNewSheet, "Tax Weekly Term-Chart");
Excel.SeriesCollection seriesCollection = (Excel.SeriesCollection)_Chart.SeriesCollection(Type.Missing);
Excel.Series series = (Excel.Series)seriesCollection.Item(4);
需要代码将系列的颜色设置为无。任何建议都会很有用。
【问题讨论】: