private static void freeGraphObjects(Graph.Chart vchart0, Graph.DataSheet vsheet0, Graph.Application vapp0) { vapp0.Quit(); GC.SuppressFinalize(vsheet0); GC.SuppressFinalize(vapp0); GC.SuppressFinalize(vchart0); }
public void add_chart1(ref List<Team> teams,ref List<Team> teams1 ) { objChart1 = objslide1.Shapes[1].OLEFormat.Object; objChart = objSlide.Shapes[1].OLEFormat.Object; Graph.SeriesCollection ss = objChart.SeriesCollection(); kj = ss.Item(1).Points(); // sc.Item(1).Values = 5; // questions[question_no].datasheet = objChart.Application.DataSheet; /* datasheet.Cells[1, 3] = "ali"; datasheet.Cells[1, 4] = "ali"; datasheet.Cells[1, 5] = "ali"; datasheet.Cells[2, 4] = kk.Count; */ //objChart.ApplyDataLabels(); datasheet= objChart.Application.DataSheet; //float total = 0; //for (int i = 2; i <= choices_no1 + 1; i++) //{ // total = (total + questions[question_no].values[i - 2]); //} objChart.ApplyDataLabels(); for (int i = 2; (16 - i) >= 0; i++) { datasheet.Cells[1, i] = teams[16 - i].KeyPad; // kj.Item(i - 1).Interior.Color = } for (int i = 2; (16-i) >=0 ; i++) { // Graph.DataLabel label = ss.Item(1).DataLabels(i - 1); datasheet.Cells[2, i] = teams[16-i].points; kj.Item(i - 1).Interior.Color = teams[16-i].bc; } Graph.Axes chart1 = objChart.Axes(); objchart2 = objSlide.Shapes[2].OLEFormat.Object; Graph.Axes chart2 = objchart2.Axes(); ss = objchart2.SeriesCollection(); kj = ss.Item(1).Points(); // sc.Item(1).Values = 5; // questions[question_no].datasheet = objChart.Application.DataSheet; /* datasheet.Cells[1, 3] = "ali"; datasheet.Cells[1, 4] = "ali"; datasheet.Cells[1, 5] = "ali"; datasheet.Cells[2, 4] = kk.Count; */ //objChart.ApplyDataLabels(); datasheet3 = objchart2.Application.DataSheet; //float total = 0; //for (int i = 2; i <= choices_no1 + 1; i++) //{ // total = (total + questions[question_no].values[i - 2]); //} objchart2.ApplyDataLabels(); for (int i = 2; (31-i) >14; i++) { datasheet3.Cells[1, i] = teams[31-i].KeyPad; // kj.Item(i - 1).Interior.Color = } for (int i = 2; (31 - i) >14; i++) { // Graph.DataLabel label = ss.Item(1).DataLabels(i - 1); datasheet3.Cells[2, i] = teams[31 - i].points; kj.Item(i - 1).Interior.Color = teams[31 - i].bc; } //second slide objChart1 =objslide1.Shapes[1].OLEFormat.Object; ss = objChart1.SeriesCollection(); // sc.Item(1).Values = 5; // questions[question_no].datasheet = objChart.Application.DataSheet; /* datasheet.Cells[1, 3] = "ali"; datasheet.Cells[1, 4] = "ali"; datasheet.Cells[1, 5] = "ali"; datasheet.Cells[2, 4] = kk.Count; */ //objChart.ApplyDataLabels(); datasheet1 = objChart1.Application.DataSheet; //float total = 0; //for (int i = 2; i <= choices_no1 + 1; i++) //{ // total = (total + questions[question_no].values[i - 2]); //} objChart1.ApplyDataLabels(); for (int i = 2; (i - 2) < teams1.Count; i++) { datasheet1.Cells[1, i] = teams1[i - 2].KeyPad; // kj.Item(i - 1).Interior.Color = } for (int i = 2; (i - 2) < teams1.Count; i++) { // Graph.DataLabel label = ss.Item(1).DataLabels(i - 1); datasheet1.Cells[2, i] = teams1[i - 2].time; kj = ss.Item(1).Points(); kj.Item(i - 1).Interior.Color = teams1[i - 2].bc; } }
private static void initGraphParams(Word.Application wordapp, Word.Document worddoc, out Graph.Chart vchart0, out Graph.DataSheet vsheet0, out Graph.Application vapp0, int gn = 0) { Word.Range rng0; Word.OLEFormat oleF0; rng0 = wordapp.Selection.Range; if (gn == 0) { rng0.Collapse(Direction: Word.WdCollapseDirection.wdCollapseEnd); rng0.InsertAfter("\r"); rng0.Collapse(Direction: Word.WdCollapseDirection.wdCollapseEnd);//rng0.Collapse( Direction:0); } oleF0 = worddoc.InlineShapes.AddOLEObject(ClassType: "MSGraph.Chart.8", Range: rng0).OLEFormat; oleF0.DoVerb(); vchart0 = oleF0.Object; vapp0 = vchart0.Application; vsheet0 = vapp0.DataSheet; vsheet0.Cells.Clear(); vsheet0.Cells.Clear(); }