private void button1_Click(object sender, System.EventArgs e)
        {
            // copy the book
            string xlsFileName = "..\\..\\XlsxTestBin.xlsm";

            c1XLBook1.Load(xlsFileName);
            c1XLBook1.Sheets[0][0, 0].Value = "It is copy!";
            xlsFileName = xlsFileName.Replace(".xlsm", "Modified.xlsm");
            c1XLBook1.Save(xlsFileName);

            // run Excel file
            System.Diagnostics.Process.Start(xlsFileName);
        }
Ejemplo n.º 2
0
 private void button1_Click(object sender, System.EventArgs e)
 {
     // load book
     using (OpenFileDialog dlg = new OpenFileDialog())
     {
         dlg.FileName = "*.xls";
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             c1XLBook1.Load(dlg.FileName);
             ShowPrintSettings();
         }
     }
 }
Ejemplo n.º 3
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            // choose file
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.DefaultExt = "xls";
            dlg.FileName   = "*.xls";
            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            // clear everything
            _book.Clear();
            _grids.Clear();
            _list.Items.Clear();

            // load book
            _book.Load(dlg.FileName);

            // create one grid per sheet and add them to listbox
            foreach (XLSheet sheet in _book.Sheets)
            {
                // add sheet name to list box
                _list.Items.Add(sheet.Name);

                // create a new grid for this sheet, add to list
                C1FlexGrid flex = new C1FlexGrid();
                flex.Name = sheet.Name;
                _grids.Add(flex);

                // load sheet into new grid
                LoadSheet(flex, sheet, true);
            }

            // select current sheet
            _list.SelectedIndex = _book.Sheets.SelectedIndex;
            txt_fr.Text         = 1 + "";
            txt_to.Text         = _flex.Rows.Count - 1 + "";
        }