读书人

用.net在Excel中插入图表的时候如何

发布时间: 2012-02-15 12:09:44 作者: rapoo

用.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

读书人网 >.NET

热点推荐