private void ExportaExcel() { cARGANDO.Show(); Microsoft.Office.Interop.Excel.Application Excel = new Microsoft.Office.Interop.Excel.Application(); Excel.Application.Workbooks.Add(true); int IndiceColumna = 0; cARGANDO.Progreso(20); foreach (DataGridViewColumn columna in dtgClientes.Columns) { if (columna.Visible == true) { IndiceColumna++; Excel.Cells[1, IndiceColumna] = columna.HeaderText; } } cARGANDO.Progreso(70); int IndiceFila = 0; foreach (DataGridViewRow Row in dtgClientes.Rows) { IndiceFila++; IndiceColumna = 0; foreach (DataGridViewColumn Columna in dtgClientes.Columns) { if (Columna.Visible == true) { IndiceColumna++; Excel.Cells[IndiceFila + 1, IndiceColumna] = Row.Cells[Columna.Name].Value; } } } cARGANDO.Progreso(100); cARGANDO.Hide(); Excel.Visible = true; }
private void btnCargando_Click(object sender, EventArgs e) { CARGANDO carg = new CARGANDO(); carg.Show(); }