问题描述
如题,我要在网站上根据数据源导出一个Excel曲线图到本地,在生成数据源是没有问题,但是在执行画图时,报出了该对象无标题。在网上找寻了很久并没有查看到具体的解决方法,请熟悉Excel的高手帮忙解答下,或者告知这个问题的原因的解决思路,谢谢!数据源生成没有问题,如下:
解决方案
解决方案二:
百度你懂的、搜一12
解决方案三:
Excel.WorkbookMyWorkbook=(Excel.Workbook)MySheet.Parent;Excel.ApplicationMyApp=(Excel.Application)MyWorkbook.Parent;//Excel.ChartMyChart=(Excel.Chart)MyApp.Charts.Add(Missing.Value,Missing.Value,Missing.Value,Missing.Value);MyApp.Charts.Add(Missing.Value,MySheet,Missing.Value,Missing.Value);//Charts.Add//MySheet.Application.ActiveChart.PlotArea.Width=400;//MySheet.Application.ActiveChart.PlotArea.Height=300;MySheet.Application.ActiveChart.ChartType=charttype;MySheet.Application.ActiveChart.SetSourceData(MyRange,Excel.XlRowCol.xlColumns);
解决方案四:
Excel.WorkbookMyWorkbook=(Excel.Workbook)MySheet.Parent;Excel.ApplicationMyApp=(Excel.Application)MyWorkbook.Parent;intlastcol=ExcelFindLastColumn(MySheet);doubleleftstr=cm.cfloat(MySheet.get_Range(gotchar(lastcol+1)+MyRange.Row,Missing.Value).Left.ToString())+5;doubletop=cm.cfloat(MyRange.Top.ToString())+2;MySheet.Shapes.AddChart(Excel.XlChartType.xlBarStacked,leftstr,top,592,348).Select(Missing.Value);MySheet.Application.ActiveChart.SetSourceData(MyRange,Microsoft.Office.Interop.Excel.XlRowCol.xlColumns);MySheet.Application.ActiveChart.Legend.Position=Microsoft.Office.Interop.Excel.XlLegendPosition.xlLegendPositionTop;MySheet.Application.ActiveChart.Legend.Left=2;MySheet.Application.ActiveChart.Legend.Width=580;MySheet.Application.ActiveChart.Legend.Top=15;MySheet.Application.ActiveChart.Legend.Height=20;MySheet.Application.ActiveChart.Legend.Border.LineStyle=Excel.XlLineStyle.xlContinuous;MySheet.Application.ActiveChart.Legend.Border.Weight=0.75;//Excel.XlBorderWeight.xlThin;MySheet.Application.ActiveChart.Legend.Border.ColorIndex=57;MySheet.Application.ActiveChart.HasTitle=true;MySheet.Application.ActiveChart.ChartTitle.Text=getMonthFullName(cm.ctodate(reportvariables.reportMonthStart).Month.ToString())+"-"+getMonthFullName(cm.ctodate(reportvariables.reportMonthEnd).Month.ToString())+""+year.Substring(0,4);MySheet.Application.ActiveChart.ChartTitle.Font.Size=8;MySheet.Application.ActiveChart.ChartArea.Border.Weight=1;MySheet.Application.ActiveChart.ChartArea.Border.LineStyle=-4105;