Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            // Import DataTable according to the selected cell
            Worksheet activeWorksheet = workbook.Worksheets.ActiveWorksheet;
            CellRange selection       = activeWorksheet.SelectedCell;

            spreadsheetControl1.BeginUpdate();
            activeWorksheet.Import(ManualDataSet.CreateData().Tables[0], true, selection.TopRowIndex, selection.LeftColumnIndex);
            spreadsheetControl1.EndUpdate();
        }
        public static ManualDataSet CreateData()
        {
            ManualDataSet ds    = new ManualDataSet();
            DataTable     table = ds.Tables["table"];

            table.Rows.Add(new object[] { 0, DateTime.Today, "A", 103 });
            table.Rows.Add(new object[] { 1, DateTime.Today, "B", 200 });
            table.Rows.Add(new object[] { 2, DateTime.Today, "C", 446 });

            return(ds);
        }