Exemple #1
0
        private void btnnewChart_Click(object sender, EventArgs e)
        {
            ExcelBinder excelbinder = new ExcelBinder();

            excelbinder.NewDocument();

            excelbinder.Visible = true;

            excelbinder.SetActiveWorkSheet(1);

            excelbinder.SetValue(1, 2, "Student1");
            excelbinder.SetValue(1, 3, "Student2");
            excelbinder.SetValue(1, 4, "Student3");

            excelbinder.SetValue(2, 1, "Term1");
            excelbinder.SetValue(2, 2, "80");
            excelbinder.SetValue(2, 3, "65");
            excelbinder.SetValue(2, 4, "45");

            excelbinder.SetValue(3, 1, "Term2");
            excelbinder.SetValue(3, 2, "78");
            excelbinder.SetValue(3, 3, "72");
            excelbinder.SetValue(3, 4, "60");

            excelbinder.SetValue(4, 1, "Term3");
            excelbinder.SetValue(4, 2, "82");
            excelbinder.SetValue(4, 3, "80");
            excelbinder.SetValue(4, 4, "65");

            excelbinder.SetValue(5, 1, "Term4");
            excelbinder.SetValue(5, 2, "75");
            excelbinder.SetValue(5, 3, "82");
            excelbinder.SetValue(5, 4, "68");

            ExcelBinder.ExlChartType ctype = GetChartType(cbChartType.SelectedIndex);
            excelbinder.CreateChart(1, 1, 5, 4, 100, 100, 400, 400, ctype);

            excelbinder.SaveDocument(Path.Combine(Environment.CurrentDirectory, "testchart" + (int)ctype + ".xlsx"));

            excelbinder.CloseDocument();

            excelbinder.QuitDocument();
        }