日期:2014-05-20  浏览次数:20872 次

用.net在Excel中插入图表的时候,怎么指定位置,目前都是在同一个位置
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个图标都重叠了


------解决方案--------------------
探讨

没有人来,我就转到灌水区了
问题解决了
用left,top