Exemplo n.º 1
0
 private void BtnExportarExcel_Click(object sender, EventArgs e)
 {
     try
     {
         string _msg           = "Se genero el archivo excel de forma satisfactoria en la siguiente ubicación.\n{0}";
         FolderBrowserDialog f = new FolderBrowserDialog();
         f.ShowDialog(this);
         if (f.SelectedPath != "")
         {
             Cursor = Cursors.AppStarting;
             Office ObjOffice = new Office();
             ObjOffice.DoExcell(f.SelectedPath + @"\" + "PMAI" + "-" + DateTime.Now.Day.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Year.ToString() + "-" + DateTime.Now.Hour.ToString() + "h" + DateTime.Now.Minute.ToString() + "min.xls", Ds.Tables["DtPlanProduccionMAI"], "Produccion usada para macroinsumos del día " + DateTime.Now.ToString());
             ObjOffice.DoExcell(f.SelectedPath + @"\" + "PMII" + "-" + DateTime.Now.Day.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Year.ToString() + "-" + DateTime.Now.Hour.ToString() + "h" + DateTime.Now.Minute.ToString() + "min.xls", Ds.Tables["DtPlanProduccionMII"], "Produccion usada para microinsumos del día " + DateTime.Now.ToString());
             string _nM = string.Format(_msg, f.SelectedPath);
             MessageBox.Show(_nM, "Exportar", MessageBoxButtons.OK, MessageBoxIcon.Information);
             Cursor = Cursors.Default;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Cursor = Cursors.Default;
     }
 }