嗨,我有以下代码
private static void exportChart()
{
Excel.Range chartRange;
Excel.ChartObjects xlCharts = (Excel.ChartObjects)oWorkSheet.ChartObjects(Type.Missing);
Excel.ChartObject myChart = (Excel.ChartObject)xlCharts.Add(10, 80, 300, 150);
Excel.Chart chartPage = myChart.Chart;
chartRange = oWorkSheet.get_Range("E5", "F13");
chartPage.SetSourceData(chartRange, misValue);
chartPage.ChartType = Excel.XlChartType.xlColumnClustered;
Excel.Range chartPlacementRange = oWorkSheet.get_Range("F11", "F11");
myChart.Left = (float)((double)chartPlacementRange.Top);
myChart.Top = (float)((double)chartPlacementRange.Left);
}
我试图删除/隐藏图表中的图例,我已经尝试了
this
链接
chart.Legend.LegendEnteries(chart.Legend.LegendEntries().Count).Delete();
所以我的情况是这样的
chartPage.Legend.LegendEntries(chartPage.Legend.LegendEntries().Count).Delete();
但不幸的是,这是我所能做到的。。。。。(键入两次LegendEntries后,它不可用.count或.delete)
chartPage.Legend.LegendEntries(chartPage.Legend.LegendEntries());
如何正确地做?