Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            DataTable tableOutput = null;
            var       adapter     = new ExcelWorkBookAdaptor();

            adapter.Open("C:/temp/Book1.xlsx");
            var   xlRangeAdapter = new ExcelRangeToDataTableAdapter(adapter[0]);
            Point topLeft        = new Point(1, 1);
            Point bottomRight    = new Point(2, 20);

            try
            {
                tableOutput = xlRangeAdapter.ReadTable("A1:B21");
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
            finally
            {
                adapter.CloseNoSave();
            }


            var calc = new PythagoreanCalculator();

            //var generator = new CentroidDistanceGenerator(calc);
            //CentroidTest(tableOutput, generator);

            MatrixTest(tableOutput, ref adapter, ref topLeft, calc);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            DataTable tableOutput = null;
            var adapter = new ExcelWorkBookAdaptor();
            adapter.Open("C:/temp/Book1.xlsx");
            var xlRangeAdapter = new ExcelRangeToDataTableAdapter(adapter[0]);
            Point topLeft = new Point(1, 1);
            Point bottomRight = new Point(2, 20);

            try
            {
                tableOutput = xlRangeAdapter.ReadTable("A1:B21");
            }
            catch(Exception ex)
            {
                Console.Write(ex.Message);
            }
            finally
            {
                adapter.CloseNoSave();
            }

            var calc = new PythagoreanCalculator();

            //var generator = new CentroidDistanceGenerator(calc);
            //CentroidTest(tableOutput, generator);

            MatrixTest(tableOutput, ref adapter, ref topLeft, calc);
        }
Ejemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            DataTable tableOutput = null;
            var       adapter     = new ExcelWorkBookAdaptor();

            adapter.Open("C:/temp/Book1.xlsx");
            adapter.Show();
            var   xlRangeAdapter = new ExcelRangeToDataTableAdapter(adapter[0]);
            Point topLeft        = new Point(1, 1);
            Point bottomRight    = new Point(2, 20);

            try
            {
                tableOutput = xlRangeAdapter.ReadTable("A1:B21");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                adapter.CloseNoSave();
            }


            if (null != tableOutput)
            {
                adapter = new ExcelWorkBookAdaptor();
                adapter.NewBook();
                adapter.Show();
                var tableAdapter = new DataTableToExcelAdapter(adapter[0], tableOutput);
                tableAdapter.Write(topLeft);

                //adapter.SaveAndClose("C:/temp/Book2.xlsx");
            }
        }