Example #1
0
        //Ver Clientes
        private void VerListaClientes()
        {
            //Nueva instancia form Lista Clientes
            Clientes.frmListaClientes formListaClientes = new Clientes.frmListaClientes();

            formListaClientes.ShowDialog();
        }
Example #2
0
        // M E T O D O S **************************************


        #region Exportar

        // Exportar Clientes
        public void exportarClientes()
        {
            Clientes.frmListaClientes frmListaClientes = new frmListaClientes();


            frmListaClientes.Show();
            frmListaClientes.Hide();

            Microsoft.Office.Interop.Excel.ApplicationClass ExcelAppCli = new Microsoft.Office.Interop.Excel.ApplicationClass();
            ExcelAppCli.Application.Workbooks.Add(Type.Missing);

            SaveFileDialog drCli = new SaveFileDialog();

            drCli.FileName = "Clientes " + DateTime.Now.Day.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Year.ToString();
            drCli.Filter   = "Excel files (*.xls)|*.xls";
            drCli.Title    = "CLIENTES";


            if (drCli.ShowDialog() == DialogResult.OK)
            {
                for (int i = 1; i < frmListaClientes.dgvListadoClientes.Columns.Count + 1; i++)
                {
                    ExcelAppCli.Cells[1, i] = frmListaClientes.dgvListadoClientes.Columns[i - 1].HeaderText;
                }

                for (int i = 0; i < frmListaClientes.dgvListadoClientes.Rows.Count; i++)
                {
                    for (int j = 0; j < frmListaClientes.dgvListadoClientes.Columns.Count; j++)
                    {
                        ExcelAppCli.Cells[i + 2, j + 1] = frmListaClientes.dgvListadoClientes.Rows[i].Cells[j].Value.ToString();
                    }
                }


                ExcelAppCli.ActiveWorkbook.SaveCopyAs(drCli.FileName);
                ExcelAppCli.ActiveWorkbook.Saved = true;
                ExcelAppCli.Quit();
            }
            int cantCli = frmListaClientes.dgvListadoClientes.Rows.Count;
        }
        // Exportar Clientes
        public void exportarClientes()
        {
            Clientes.frmListaClientes frmListaClientes = new frmListaClientes();

            frmListaClientes.Show();
            frmListaClientes.Hide();

            Microsoft.Office.Interop.Excel.ApplicationClass ExcelAppCli = new Microsoft.Office.Interop.Excel.ApplicationClass();
            ExcelAppCli.Application.Workbooks.Add(Type.Missing);

            SaveFileDialog drCli = new SaveFileDialog();
            drCli.FileName = "Clientes " + DateTime.Now.Day.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Year.ToString();
            drCli.Filter = "Excel files (*.xls)|*.xls";
            drCli.Title = "CLIENTES";

            if (drCli.ShowDialog() == DialogResult.OK)
            {
                for (int i = 1; i < frmListaClientes.dgvListadoClientes.Columns.Count + 1; i++)
                {
                    ExcelAppCli.Cells[1, i] = frmListaClientes.dgvListadoClientes.Columns[i - 1].HeaderText;
                }

                for (int i = 0; i < frmListaClientes.dgvListadoClientes.Rows.Count; i++)
                {
                    for (int j = 0; j < frmListaClientes.dgvListadoClientes.Columns.Count; j++)
                    {
                        ExcelAppCli.Cells[i + 2, j + 1] = frmListaClientes.dgvListadoClientes.Rows[i].Cells[j].Value.ToString();
                    }
                }

                ExcelAppCli.ActiveWorkbook.SaveCopyAs(drCli.FileName);
                ExcelAppCli.ActiveWorkbook.Saved = true;
                ExcelAppCli.Quit();
            }
            int cantCli = frmListaClientes.dgvListadoClientes.Rows.Count;
        }
Example #4
0
        //Ver Clientes
        private void VerListaClientes()
        {
            //Nueva instancia form Lista Clientes
            Clientes.frmListaClientes formListaClientes = new Clientes.frmListaClientes();

            formListaClientes.ShowDialog();
        }