oSeries.XValues = oWS.get_Range("A2", "A6");
for( int iRet = 1; iRet <= iNumQtrs; iRet++)
{ oSeries = (Excel.Series)oChart.SeriesCollection(iRet);
String seriesName;
seriesName = "=\"Q";
seriesName = String.Concat( seriesName, iRet );
seriesName = String.Concat( seriesName, "\"" );
oSeries.Name = seriesName; }
oChart.Location( Excel.XlChartLocation.xlLocationAsObject, oWS.Name );
//Move the chart so as not to cover your data.
oResizeRange = (Excel.Range)oWS.Rows.get_Item(10, Missing.Value ); oWS.Shapes.Item("Chart 1").Top = (float)(double)oResizeRange.Top;
oResizeRange = (Excel.Range)oWS.Columns.get_Item(2, Missing.Value ); oWS.Shapes.Item("Chart 1").Left = (float)(double)oResizeRange.Left; }
Kod oynasining yuqori qismiga o'ting. Foydalanish direktivalari ro'yxatining oxiriga quyidagi qatorni qo'shing:
C#
using Excel = Microsoft.Office.Interop.Excel; using System.Reflection;
Avtomatlashtirish mijozini sinab ko'ring
Dasturni yaratish va ishga tushirish uchun F5 tugmasini bosing.
Shaklda 1 tugmachasini bosing. Dastur Excelni ishga tushiradi va ma'lumotlarni yangi ish varag'iga to'ldiradi.
Sizdan choraklik savdo ma'lumotlarini kiritish so'ralganda, Ha ni bosing. Ish varag'iga choraklik ma'lumotlar bilan bog'langan diagramma qo'shiladi.
Xulosa
Foydalanilgan adabiyotlar ro’yxati
Do'stlaringiz bilan baham: |