c# - How to pass data fromC# to Microsoft excel? -


hi looking program sends data c# windows form microsoft excel , plot these data in x-y line graph!

        excel.application xlapp;         excel.workbook xlworkbook;         excel.worksheet xlworksheet;         object misvalue = system.reflection.missing.value;          xlapp = new excel.application();         xlworkbook = xlapp.workbooks.add(misvalue);         xlworksheet = (excel.worksheet)xlworkbook.worksheets.get_item(1);         double t2 = 20;         int t1 = 10;         int i, j;         double []s= new double[10];    (i = 0; <= t1; i++)  {  (j = 0; j <= t2; j++)  {        xlworksheet.cells[(i+1), (j+1)] = s[(j / 2)];       excel.range chartrange;       excel.chartobjects xlcharts = (excel.chartobjects)xlworksheet.chartobjects(type.missing);      excel.chartobject mychart = (excel.chartobject)xlcharts.add(100, 80, 300, 250);       excel.chart chartpage = mychart.chart;       chartrange = xlworksheet.get_range("a1", "z10");       j += 1;      chartpage.setsourcedata(chartrange, misvalue);       chartpage.charttype = excel.xlcharttype.xlxyscattersmooth;    } }      xlworkbook.saveas("link1.xls", excel.xlfileformat.xlworkbooknormal, misvalue, misvalue, misvalue, misvalue, excel.xlsaveasaccessmode.xlexclusive, misvalue, misvalue, misvalue, misvalue, misvalue) 

u can modify code accordingly!!


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -