December 2nd, 2012, 04:56 AM
#1
Excel automation problem
I've used http://csharp.net-informations.com/e...xcel-chart.htm
to create a chart, and that works.
I have a little problem, however. I need the data to come from several columns, as the sheet I'm going to make will have one chart with one graph, but use the data of several columns.
So, I took the sheet, and tried to make some modifications, and that worked.
The formula for the graph is now:
=SERIES(Sheet1!$B$1;(Sheet1!$A$2;Sheet1!$A$3;Sheet1!$A$4;Sheet1!$A$5;Sheet1!$E$2;Sheet1!$E$3;Sheet1!$E$4;Sheet1!$E$5);(Sheet1!$B$2;Sheet1!$B$3;Sheet1!$B$4;Sheet1!$B$5;Sheet1!$F$2;Sheet1!$F$3;Sheet1!$F$4;Sheet1!$F$5);1)
Which means, that I now have added Term5-8 and corresponding values for Student1.
How to translate the above formula into code? I've tried adding:
Code:
Excel.SeriesCollection seriesCollection = (Excel.SeriesCollection)chartPage.SeriesCollection(misValue);
Excel.Series series1 = seriesCollection.NewSeries();
series1.Formula = "=SERIES(Sheet1!$B$1;(Sheet1!$A$2;Sheet1!$A$3;Sheet1!$A$4;Sheet1!$A$5;Sheet1!$E$2;Sheet1!$E$3;Sheet1!$E$4;Sheet1!$E$5);(Sheet1!$B$2;Sheet1!$B$3;Sheet1!$B$4;Sheet1!$B$5;Sheet1!$F$2;Sheet1!$F$3;Sheet1!$F$4;Sheet1!$F$5);1)";
but that just gives me an exception :-(
I hope someone has a solution for this one...thanks in advance.
/Lars VJ
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks