Ejemplo n.º 1
0
        public void SimpleRead()
        {
            string filename = TestData.DataPath + "\\SpecificationTestData.xls";

            Assert.IsTrue(System.IO.File.Exists(filename), "missing file " + filename);
            Series s = SpreadsheetGearSeries.ReadFromFile(filename, "Sheet1", "Date", "JulianDay");

            for (int i = 0; i < s.Messages.Count; i++)
            {
                Console.WriteLine(s.Messages[i]);
            }

            Assert.IsTrue(s.Count > 789, "not enough points" + filename);
        }
Ejemplo n.º 2
0
        public void ConnectionString()
        {
            string filename = TestData.DataPath + "\\SpecificationTestData.xls";

            Assert.IsTrue(System.IO.File.Exists(filename), "missing file " + filename);
            Series s     = SpreadsheetGearSeries.ReadFromFile(filename, "Sheet1", "Date", "JulianDay");
            int    count = s.Count;

            Assert.IsTrue(s.Count > 100);
            s.Clear();
            Assert.IsTrue(s.Count == 0);
            Series s2 = SpreadsheetGearSeries.CreateFromConnectionString(s.ConnectionString, "");

            s2.Read();
            Assert.AreEqual(count, s2.Count);
        }
Ejemplo n.º 3
0
        private void newExcel_Click(object sender, EventArgs e)
        {
            if (openExcelDialog.ShowDialog() == DialogResult.OK)
            {
                SelectExcelSeries dlg = new SelectExcelSeries(openExcelDialog.FileName);

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    Series s = SpreadsheetGearSeries.ReadFromFile(dlg.WorkBook, dlg.SheetName, dlg.DateColumn, dlg.ValueColumn);
                    if (s.Count > 0)
                    {
                        DB.AddSeries(s, tree1.SelectedID);
                    }
                    else
                    {
                        MessageBox.Show("No data in the selection.  File " + openExcelDialog.FileName);
                    }
                }
            }
        }