- C# code
public void InsertActiveChart(Excel.XlChartType ChartType, string ws, int DataSourcesX1, int DataSourcesY1, int DataSourcesX2, int DataSourcesY2, Excel.XlRowCol ChartDataType)//插入图表操作 { ChartDataType = Excel.XlRowCol.xlColumns; wb.Charts.Add(Type.Missing, Type.Missing, Type.Missing, Type.Missing); { string StartColumn = GetColumnName(DataSourcesX1); string EndColumn = GetColumnName(DataSourcesX2); wb.ActiveChart.ChartType = ChartType; wb.ActiveChart.SetSourceData(GetSheet(ws).get_Range(StartColumn + DataSourcesY1.ToString(), EndColumn + DataSourcesY2.ToString())); wb.ActiveChart.Location(Excel.XlChartLocation.xlLocationAsObject, ws); } }//插入图表excel.InsertActiveChart(Excel.XlChartType.xlLine, "Sheet1", 1, 1, 15, 3, Excel.XlRowCol.xlColumns);excel.InsertActiveChart(Excel.XlChartType.xlLine, "Sheet1", 1, 20, 15, 23, Excel.XlRowCol.xlColumns);
这2个图标都重叠了
------解决方案--------------------