public override void GenerarEXCEL(string titulo = "")
        {
            DataRow  fila0;
            string   pathFile = "";
            string   pathPlantilla = "";
            string   cedulaRNC = "";
            string   periodo = "";
            string   tipoId = "", ncf = "", ncfModificado = "";
            DateTime fecha = DateTime.Now;
            string   feComprobante = "";
            double   itbis = 0, monto = 0;
            int      lineaNo = 12;


            OfficeDriver.ExcelDriver objExcel = null;

            try
            {
                if (MyData == null)
                {
                    return;
                }

                if (!objUtil.IsMSExcelIntalled())
                {
                    throw new Exception("MICROSOFT EXCEL NO ESTA INSTALADO...");
                }

                Cursor   = Cursors.WaitCursor;
                objExcel = new OfficeDriver.ExcelDriver();
                objExcel.isOpenOffice = false;

                //CREAMOS Directorio para Ubicar Archivos

                //Buscamos la Plantilla de excel
                pathPlantilla = System.Environment.CurrentDirectory + @"\Files\plantilla607.xls";
                if (!File.Exists(pathPlantilla))
                {
                    pathPlantilla = GetFolderDocGenerados("DGII") + @"\plantilla607.xls";
                }

                if (File.Exists(pathPlantilla))
                {
                    pathFile = GetFolderDocGenerados("DGII") + @"\temp_plantilla607.xls";
                    if (File.Exists(pathFile))
                    {
                        File.Delete(pathFile);
                    }

                    File.Copy(pathPlantilla, pathFile);
                }
                else
                {
                    objUtil.MostrarMensajeError("NO EXISTE PALNTILLA607.xls");
                    Cursor = Cursors.Default;
                    return;
                }

                tsProgressBar.Value   = 0;
                tsProgressBar.Maximum = MyData.Rows.Count + 1;
                tsProgressBar.Width   = 350;
                tsProgressBar.Step    = 1;
                tsProgressBar.Visible = true;

                fila0     = MyData.Rows[0];
                cedulaRNC = objUtil.GetAsString("EmpresaRNC", fila0).Replace("-", "").Trim();
                periodo   = objUtil.GetAsString("Periodo", fila0).Trim();

                //ABRIMOS EL ARCHIVO
                objExcel.OpenWorkBook(pathFile);

                objExcel.SetCellValue("C4", cedulaRNC);
                objExcel.SetCellValue("C5", periodo);
                objExcel.SetCellValue("C6", conteo);
                //objExcel.SetCellValue("C7", totalMonto);

                tsProgressBar.PerformStep();

                //EJECUTAMOS LA MACRO
                objExcel.RunMacro("'Formato607.cmdDataEntry_Click'");

                foreach (DataRow item in MyData.Rows)
                {
                    Cursor = Cursors.WaitCursor;

                    cedulaRNC     = objUtil.GetAsString("CedulaRNC", item).Replace("-", "").Trim();
                    tipoId        = objUtil.GetAsString("Tipo_Identificacion", item).Trim();
                    ncf           = objUtil.GetAsString("NCF", item).Trim();
                    ncfModificado = objUtil.GetAsString("NCF_Modificado", item).Trim();
                    fecha         = objUtil.GetAsDate("Fecha_Comprobante", item);
                    feComprobante = objUtil.DateToInt(fecha).ToString().Trim();

                    itbis = objUtil.GetAsDouble("Itbis", item);
                    monto = objUtil.GetAsDouble("Monto", item);

                    objExcel.SetCellValue("B" + lineaNo.ToString(), cedulaRNC);
                    objExcel.SetCellValue("C" + lineaNo.ToString(), tipoId);
                    objExcel.SetCellValue("D" + lineaNo.ToString(), ncf);
                    objExcel.SetCellValue("E" + lineaNo.ToString(), ncfModificado);
                    objExcel.SetCellValue("F" + lineaNo.ToString(), objUtil.GetAsString("Tipo_Ingreso_DGII", item));
                    objExcel.SetCellValue("G" + lineaNo.ToString(), feComprobante);

                    if (item["Fecha_Retencion"] is DBNull)
                    {
                        objExcel.SetCellValue("H" + lineaNo.ToString(), "");
                    }
                    else
                    {
                        fecha = objUtil.GetAsDate("Fecha_Retencion", item);
                        objExcel.SetCellValue("H" + lineaNo.ToString(), objUtil.DateToInt(fecha));
                    }
                    objExcel.SetCellValue("I" + lineaNo.ToString(), monto);
                    objExcel.SetCellValue("J" + lineaNo.ToString(), itbis);
                    objExcel.SetCellValue("K" + lineaNo.ToString(), objUtil.GetAsDouble("Itbis_Retenido", item));
                    objExcel.SetCellValue("L" + lineaNo.ToString(), objUtil.GetAsDouble("Itbis_Percibido", item));
                    objExcel.SetCellValue("M" + lineaNo.ToString(), objUtil.GetAsDouble("Retencion_Renta", item));
                    objExcel.SetCellValue("N" + lineaNo.ToString(), objUtil.GetAsDouble("ISR_Percibido", item));
                    objExcel.SetCellValue("O" + lineaNo.ToString(), objUtil.GetAsDouble("Impuesto_Selectivo_Consumo", item));
                    objExcel.SetCellValue("P" + lineaNo.ToString(), objUtil.GetAsDouble("Otros_Impuestos", item));
                    objExcel.SetCellValue("Q" + lineaNo.ToString(), objUtil.GetAsDouble("Propina_Legal", item));
                    objExcel.SetCellValue("R" + lineaNo.ToString(), objUtil.GetAsDouble("EnEfectivo", item));
                    objExcel.SetCellValue("S" + lineaNo.ToString(), objUtil.GetAsDouble("EnChequesODep", item));
                    objExcel.SetCellValue("T" + lineaNo.ToString(), objUtil.GetAsDouble("EnTarjeta", item));
                    objExcel.SetCellValue("U" + lineaNo.ToString(), objUtil.GetAsDouble("EnVentaACredito", item));
                    objExcel.SetCellValue("V" + lineaNo.ToString(), objUtil.GetAsDouble("EnBonos", item));
                    objExcel.SetCellValue("W" + lineaNo.ToString(), objUtil.GetAsDouble("EnPermuta", item));
                    objExcel.SetCellValue("X" + lineaNo.ToString(), objUtil.GetAsDouble("EnOtros", item));

                    tsProgressBar.PerformStep();

                    lineaNo++;

                    Cursor = Cursors.Default;
                }

                objExcel.ShowBook();
            }
            catch (Exception ex)
            {
                if (objExcel != null)
                {
                    objExcel.CloseBook();
                }
                objUtil.MostrarMensajeError(ex.Message);
            }
            finally
            {
                objExcel = null;
                Cursor   = Cursors.Default;
            }
        }
        public override void GenerarEXCEL(string titulo = "")
        {
            DataRow  fila0;
            string   pathFile      = "";
            string   pathPlantilla = "";
            string   cedulaRNC     = "";
            string   periodo       = "";
            string   ncf           = "";
            DateTime fecha         = DateTime.Now;
            string   feComprobante = "";
            string   tipoAnulacion;
            int      lineaNo = 12;


            OfficeDriver.ExcelDriver objExcel = new OfficeDriver.ExcelDriver();

            try
            {
                if (MyData == null)
                {
                    return;
                }
                if (!objUtil.IsMSExcelIntalled())
                {
                    throw new Exception("MICROSOFT EXCEL NO ESTA INSTALADO...");
                }

                Cursor = Cursors.WaitCursor;
                objExcel.isOpenOffice = false;

                //Buscamos la Plantilla de excel
                pathPlantilla = System.Environment.CurrentDirectory + @"\Files\plantilla608.xls";
                if (!File.Exists(pathPlantilla))
                {
                    pathPlantilla = GetFolderDocGenerados("DGII") + @"\plantilla608.xls";
                }

                if (File.Exists(pathPlantilla))
                {
                    pathFile = GetFolderDocGenerados("DGII") + @"\temp_plantilla608.xls";
                    if (File.Exists(pathFile))
                    {
                        File.Delete(pathFile);
                    }

                    File.Copy(pathPlantilla, pathFile);
                }
                else
                {
                    objUtil.MostrarMensajeError("NO EXISTE PALNTILLA608.xls");
                    Cursor = Cursors.Default;
                    return;
                }

                tsProgressBar.Value   = 0;
                tsProgressBar.Maximum = MyData.Rows.Count + 1;
                tsProgressBar.Width   = 350;
                tsProgressBar.Step    = 1;
                tsProgressBar.Visible = true;

                fila0     = MyData.Rows[0];
                cedulaRNC = objUtil.GetAsString("EmpresaRNC", fila0).Replace("-", "");
                periodo   = objUtil.GetAsString("Periodo", fila0);

                //ABRIMOS EL ARCHIVO
                objExcel.OpenWorkBook(pathFile);

                objExcel.SetCellValue("C5", cedulaRNC);
                objExcel.SetCellValue("C6", periodo);
                objExcel.SetCellValue("C7", conteo);


                tsProgressBar.PerformStep();

                //EJECUTAMOS LA MACRO
                objExcel.RunMacro("'Formato608.cmdDataEntry_Click'");

                foreach (DataRow item in MyData.Rows)
                {
                    Cursor = Cursors.WaitCursor;

                    ncf           = objUtil.GetAsString("NCF", item);
                    fecha         = objUtil.GetAsDate("Fecha_Comprobante", item);
                    feComprobante = objUtil.DateToInt(fecha).ToString();

                    tipoAnulacion = objUtil.GetAsString("Tipo_Anulacion", item);

                    objExcel.SetCellValue("B" + lineaNo.ToString(), ncf);
                    objExcel.SetCellValue("D" + lineaNo.ToString(), feComprobante);
                    objExcel.SetCellValue("E" + lineaNo.ToString(), tipoAnulacion);

                    tsProgressBar.PerformStep();

                    lineaNo++;

                    Cursor = Cursors.Default;
                }

                objExcel.ShowBook();
            }
            catch (Exception ex)
            {
                if (objExcel != null)
                {
                    objExcel.CloseBook();
                }
                objUtil.MostrarMensajeError(ex.Message);
            }
            finally
            {
                objExcel = null;
                Cursor   = Cursors.Default;
            }
        }