Exemple #1
0
 public void PreviousPosition()
 {
     if (this.CurrentPosition > 0)
     {
         try
         {
             this.CurrentPosition       = this.CurrentPosition - 1;
             this.mObjProgressBar.Value = this.CurrentPosition;
         }
         catch
         {
             MemoryUtility.ReleaseComObject(this.mObjProgressBar);
             this.mObjProgressBar       = this.pObjApplication.StatusBar.CreateProgressBar(this.Message, this.MaximumPosition, this.IsStopable);
             this.mObjProgressBar.Value = this.CurrentPosition;
         }
     }
     else
     {
         try
         {
             this.mObjProgressBar.Value = 0;
         }
         catch
         {
             MemoryUtility.ReleaseComObject(this.mObjProgressBar);
             this.mObjProgressBar       = this.pObjApplication.StatusBar.CreateProgressBar(this.Message, this.MaximumPosition, this.IsStopable);
             this.mObjProgressBar.Value = 0;
         }
     }
 }
        public static bool Create_ProgressBar(ref SAPbouiCOM.ProgressBar oProgBarx, string sMessage, int iValue)
        {
            bool bSucess = false;

            //********************* PROGRESS BAR
            try
            {
                GC.Collect();
                oProgBarx = null;
                System.Runtime.InteropServices.Marshal.ReleaseComObject(oProgBarx);
                oProgBarx = null;
                GC.Collect();
                bSucess = true;
            }
            catch (Exception) { }

            try
            {
                oProgBarx        = Application.SBO_Application.StatusBar.CreateProgressBar(sMessage, iValue, true);
                oProgBarx.Value  = 0;
                oProgBarx.Value += 1;
                bSucess          = true;
            }
            catch (Exception)
            { bSucess = false; }

            return(bSucess);
        }
Exemple #3
0
 public void Dispose()
 {
     try
     {
         MemoryUtility.ReleaseComObject(this.mObjProgressBar);
         this.mObjProgressBar = (SAPbouiCOM.ProgressBar)null;
     }
     catch
     {
         //Ignore
     }
 }
Exemple #4
0
        public ProgressBarManager(SAPbouiCOM.Application pObjApplication, string pStrProgressBarMessage, int pIntMaximumPosition)
        {
            this.pObjApplication = pObjApplication;
            this.Message         = pStrProgressBarMessage;
            this.MaximumPosition = pIntMaximumPosition;

            this.IsStopable      = ProgressBarManager.DEFAULT_STOPABLE_VALUE;
            this.CurrentPosition = ProgressBarManager.DEFAULT_CURRENT_POSITION;

            this.mObjProgressBar         = pObjApplication.StatusBar.CreateProgressBar(this.Message, MaximumPosition, this.IsStopable);
            this.mObjProgressBar.Value   = 0;
            this.mObjProgressBar.Maximum = MaximumPosition;
        }
Exemple #5
0
 public void Stop()
 {
     try
     {
         this.mObjProgressBar.Stop();
     }
     catch
     {
         MemoryUtility.ReleaseComObject(this.mObjProgressBar);
         this.mObjProgressBar       = this.pObjApplication.StatusBar.CreateProgressBar(this.Message, this.MaximumPosition, this.IsStopable);
         this.mObjProgressBar.Value = this.CurrentPosition;
         this.mObjProgressBar.Stop();
     }
 }
        public static bool Increment_ProgressBar(ref SAPbouiCOM.ProgressBar oProgBar, int iIncrement)
        {
            bool bSucess = false;

            try
            {
                oProgBar.Value += iIncrement;
                bSucess         = true;
            }
            catch (Exception)
            { bSucess = false; }

            return(bSucess);
        }
        public static bool ChangeText_ProgressBar(ref SAPbouiCOM.ProgressBar oProgBar, string sMessage)
        {
            bool bSucess = false;

            try
            {
                oProgBar.Text = sMessage;
                bSucess       = true;
            }
            catch (Exception)
            { bSucess = false; }

            return(bSucess);
        }
Exemple #8
0
 public static void stopProgressBar()
 {
     try
     {
         SAPbouiCOM.ProgressBar objProgressbar = null;
         objProgressbar = CacheManager.CacheManager.Instance.getFromCache(T1.CacheManager.Settings._Main.progressBarCacheName);
         if (objProgressbar != null)
         {
             objProgressbar.Stop();
         }
     }
     catch (Exception er)
     {
         _Logger.Error("", er);
     }
     finally
     {
         CacheManager.CacheManager.Instance.removeFromCache(T1.CacheManager.Settings._Main.progressBarCacheName);
     }
 }
Exemple #9
0
 public static void setProgressBarMessage(string strMessage, int Value)
 {
     try
     {
         SAPbouiCOM.ProgressBar objProgressbar = null;
         objProgressbar = CacheManager.CacheManager.Instance.getFromCache(T1.CacheManager.Settings._Main.progressBarCacheName);
         if (objProgressbar != null)
         {
             objProgressbar.Text  = strMessage;
             objProgressbar.Value = Value;
         }
         else
         {
             startProgressBar(strMessage, Value);
         }
     }
     catch (Exception er)
     {
         _Logger.Error("", er);
     }
 }
Exemple #10
0
 public static void startProgressBar(string Message, int Max)
 {
     try
     {
         SAPbouiCOM.ProgressBar objProgressbar = null;
         objProgressbar = T1.CacheManager.CacheManager.Instance.getFromCache(T1.CacheManager.Settings._Main.progressBarCacheName);
         if (objProgressbar == null)
         {
             objProgressbar       = MainObject.Instance.B1Application.StatusBar.CreateProgressBar(Message, Max, false);
             objProgressbar.Value = 1;
             objProgressbar.Text  = Message;
             objProgressbar.Value = 1;
             CacheManager.CacheManager.Instance.addToCache(T1.CacheManager.Settings._Main.progressBarCacheName, objProgressbar, CacheManager.CacheManager.objCachePriority.Default);
         }
     }
     catch (Exception er)
     {
         CacheManager.CacheManager.Instance.removeFromCache(T1.CacheManager.Settings._Main.progressBarCacheName);
         _Logger.Error("", er);
     }
 }
        public static bool Close_ProgressBar(ref SAPbouiCOM.ProgressBar oProgBar)
        {
            bool bSucess = false;

            try
            {
                oProgBar.Stop();
                bSucess = true;
            }
            catch (Exception)
            {
                try
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(oProgBar);
                    oProgBar = null;
                    GC.Collect();
                    bSucess = true;
                }
                catch (Exception)
                { bSucess = false; }
            }

            return(bSucess);
        }
Exemple #12
0
        // Create XML
        public void exportXML(int[] SelectedRows)
        {
            SAPbobsCOM.Documents   oDoc         = null;
            SAPbouiCOM.ProgressBar oProgressBar = null;
            try
            {
                _btnExport.Item.Enabled = false;
                String tempName = "";
                eCommon.oCompany.XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ExportImportMode;

                int _progress = 0;
                oProgressBar      = eCommon.SBO_Application.StatusBar.CreateProgressBar("Export in progress", SelectedRows.Length, false);
                oProgressBar.Text = "Export in progress...";

                foreach (int rows in SelectedRows)
                {
                    //Sales Invoice
                    if (_grid_Trans.DataTable.GetValue("ObjType", rows).ToString() == "13")
                    {
                        oDoc     = eCommon.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices) as SAPbobsCOM.Documents;
                        tempName = "ARINVOICE";
                    }
                    //Sales Credit Note
                    else if (_grid_Trans.DataTable.GetValue("ObjType", rows).ToString() == "14")
                    {
                        oDoc     = eCommon.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oCreditNotes) as SAPbobsCOM.Documents;
                        tempName = "ARCREDITNOTE";
                    }
                    //Purchase Invoice
                    else if (_grid_Trans.DataTable.GetValue("ObjType", rows).ToString() == "18")
                    {
                        oDoc     = eCommon.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseInvoices) as SAPbobsCOM.Documents;
                        tempName = "APINVOICE";
                    }
                    //Purchase Credit Note
                    else if (_grid_Trans.DataTable.GetValue("ObjType", rows).ToString() == "19")
                    {
                        oDoc     = eCommon.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseCreditNotes) as SAPbobsCOM.Documents;
                        tempName = "APCREDITNOTE";
                    }

                    String temp = _grid_Trans.DataTable.GetValue("DocEntry", rows).ToString();
                    oDoc.GetByKey(int.Parse(temp));

                    String filepath = String.Format(_txtPath.Value + tempName + "_{0}.xml", oDoc.DocNum);

                    oDoc.SaveXML(filepath);

                    _progress         += 1;
                    oProgressBar.Value = _progress;
                }


                populateGrid(check: "N");
                _btnExport.Item.Enabled = true;
                eCommon.SBO_Application.StatusBar.SetText("Export Completed.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
            }
            catch (Exception ex) { eCommon.SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); }
            finally
            {
                if (oProgressBar != null)
                {
                    oProgressBar.Stop();
                    oProgressBar = null;
                }
                if (oDoc != null)
                {
                    eCommon.ReleaseComObject(oDoc);
                }
            }
        }
        private void InsertDate_AfterAddBtnPressed(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            try
            {
                __Form = __app.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount);

                oRs   = (SAPbobsCOM.Recordset)____bobCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                oRs1  = (SAPbobsCOM.Recordset)____bobCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                oGrid = __Form.Items.Item("grid").Specific;

                int Progress = 0;
                SAPbouiCOM.ProgressBar oProgressBar = null;
                oProgressBar = __app.StatusBar.CreateProgressBar("Updating History ", Htable.Rows.Count, true);

                #region UpdateHistoryTable
                for (int i = 0; i < Htable.Rows.Count; i++)
                {
                    try
                    {
                        int    DocEntry        = int.Parse(Htable.Rows[i][0].ToString()); //oGrid.DataTable.GetValue("DocEntry", i);
                        string CollectionNotes = Htable.Rows[i][1].ToString();            //oGrid.DataTable.GetValue("As Collection Notes", i);

                        oProgressBar.Text  = "Updating History " + i + " rows...";
                        Progress          += 1;
                        oProgressBar.Value = Progress;

                        if (!string.IsNullOrEmpty(CollectionNotes))
                        {
                            SAPbobsCOM.GeneralService        oGeneralService;
                            SAPbobsCOM.GeneralData           oGeneralData;
                            SAPbobsCOM.CompanyService        sCmp = null;
                            SAPbobsCOM.GeneralData           oChild;
                            SAPbobsCOM.GeneralDataCollection oChildren;
                            SAPbobsCOM.GeneralDataParams     oGeneralParams;

                            sCmp = ____bobCompany.GetCompanyService();

                            oGeneralService = sCmp.GetGeneralService("UDOB1CZHDR");
                            oGeneralData    = (SAPbobsCOM.GeneralData)oGeneralService.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData);

                            string SqlQry = "";
                            SqlQry = "SELECT \"Code\" FROM \"@AW_B1CZHDR\" Where \"U_DocEntry\"=" + DocEntry;
                            oRs.DoQuery(SqlQry);

                            if (oRs.RecordCount > 0)
                            {
                                ____bobCompany.StartTransaction();
                                string SqlCode = "";
                                SqlCode = "SELECT T0.\"Code\",T1.\"U_AsColNotes\",T1.\"U_UpdateDate\"  FROM \"@AW_B1CZHDR\" T0 INNER JOIN \"@AW_B1CZDTL\" T1 ON T1.\"U_DocEntry\"=T0.\"U_DocEntry\" and T0.\"Code\"=T1.\"Code\" " +
                                          " Where T0.\"U_DocEntry\"=" + DocEntry;
                                oRs1.DoQuery(SqlCode);

                                oGeneralData.SetProperty("Code", Convert.ToString(oRs1.Fields.Item("Code").Value));
                                oGeneralData.SetProperty("Name", Convert.ToString(oRs.Fields.Item("Code").Value));
                                oGeneralData.SetProperty("U_DocEntry", DocEntry);


                                oChildren = oGeneralData.Child("AW_B1CZDTL");

                                for (int j = 0; j < oRs1.RecordCount; j++)
                                {
                                    oChild = oChildren.Add();
                                    oChild.SetProperty("U_DocEntry", DocEntry);
                                    oChild.SetProperty("U_AsColNotes", oRs1.Fields.Item("U_AsColNotes").Value);
                                    oChild.SetProperty("U_UpdateDate", oRs1.Fields.Item("U_UpdateDate").Value);
                                    oRs1.MoveNext();
                                }

                                oChild = oChildren.Add();
                                oChild.SetProperty("U_DocEntry", DocEntry);
                                oChild.SetProperty("U_AsColNotes", CollectionNotes);
                                oChild.SetProperty("U_UpdateDate", DateTime.Now);

                                oGeneralService.Update(oGeneralData);
                                if (____bobCompany.InTransaction)
                                {
                                    ____bobCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit);
                                }
                            }
                            else
                            {
                                ____bobCompany.StartTransaction();
                                string SqlCode = "";
                                SqlCode = "SELECT IFNULL(MAX((CAST(\"Code\" AS int))),0)+1 \"MaxCode\",IFNULL(MAX((CAST(\"DocEntry\" AS int))),0)+1 \"MaxDocEntry\" FROM \"@AW_B1CZHDR\"";
                                oRs.DoQuery(SqlCode);

                                oGeneralData.SetProperty("Code", Convert.ToString(oRs.Fields.Item("MaxCode").Value));
                                oGeneralData.SetProperty("Name", Convert.ToString(oRs.Fields.Item("MaxCode").Value));
                                oGeneralData.SetProperty("U_DocEntry", DocEntry);

                                oChildren = oGeneralData.Child("AW_B1CZDTL");
                                oChild    = oChildren.Add();
                                oChild.SetProperty("U_DocEntry", DocEntry);
                                oChild.SetProperty("U_AsColNotes", CollectionNotes);
                                oChild.SetProperty("U_UpdateDate", DateTime.Now.Date);

                                oGeneralService.Add(oGeneralData);
                                if (____bobCompany.InTransaction)
                                {
                                    ____bobCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit);
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                }

                oProgressBar.Stop();
                Htable.Clear();
                DT.Clear();
                DT = null;
                #endregion

                string CardCode = __Form.Items.Item("Item_0").Specific.Value;

                string SqlDoc = "";
                if (!string.IsNullOrEmpty(CardCode))
                {
                    SqlDoc = "CALL AGING_REPORT ('" + CardCode + "')";
                }
                else
                {
                    SqlDoc = "CALL AGING_REPORT (NULL)";
                }
                oRs.DoQuery(SqlDoc);

                if (oRs.RecordCount > 0)
                {
                    if (DT == null)
                    {
                        DT = __Form.DataSources.DataTables.Add("DT1" + DateTime.Now.Second);
                    }

                    DT.ExecuteQuery(SqlDoc);

                    oGrid.DataTable = DT;
                    oGrid.AutoResizeColumns();

                    oGrid.Columns.Item("Customer Code").Editable = false;
                    oGrid.Columns.Item("Customer Name").Editable = false;

                    oGrid.Columns.Item("Customer Name").Editable = false;
                    oGrid.Columns.Item("Type").Editable          = false;
                    SAPbouiCOM.EditTextColumn Typcol = (SAPbouiCOM.EditTextColumn)oGrid.Columns.Item("DocEntry");
                    Typcol.LinkedObjectType = "13";
                    oGrid.Columns.Item("TransType").Visible          = false;
                    oGrid.Columns.Item("DocEntry").Editable          = false;
                    oGrid.Columns.Item("Document No.").Editable      = false;
                    oGrid.Columns.Item("Customer Ref. No.").Editable = false;
                    oGrid.Columns.Item("Posting Date").Editable      = false;
                    oGrid.Columns.Item("Due Date").Editable          = false;
                    oGrid.Columns.Item("Future").Editable            = false;
                    oGrid.Columns.Item("0-30 Days").Editable         = false;
                    oGrid.Columns.Item("31-60 Days").Editable        = false;
                    oGrid.Columns.Item("61-90 Days").Editable        = false;
                    oGrid.Columns.Item("91-120 Days").Editable       = false;
                    oGrid.Columns.Item("121+ Days").Editable         = false;

                    SAPbouiCOM.EditTextColumn col = (SAPbouiCOM.EditTextColumn)oGrid.Columns.Item("AWDocEntry");
                    col.LinkedObjectType = "UDOB1CZHDR";
                    col.Width            = 15;

                    oGrid.Columns.Item("DocEntry").Editable    = false;
                    oGrid.Columns.Item("Balance Due").Editable = false;
                    oGrid.Columns.Item("Previous Collection Notes").Editable = false;

                    oGrid.CollapseLevel = 1;
                }
            }
            catch (SqlException e)
            {
                __app.MessageBox(e.Message, 1, "Ok", "", "");
                BubbleEvent = false;
            }
            catch (COMException e)
            {
                __app.MessageBox(e.Message, 1, "Ok", "", "");
                BubbleEvent = false;
            }
            catch (Exception e)
            {
                __app.MessageBox(e.Message, 1, "Ok", "", "");
                BubbleEvent = false;
            }
        }
Exemple #14
0
        static void Main(string[] args)
        {
            try
            {//Conexion con SAP
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Connection oConnection = new Connection();
                oConnection.SetApplication();

                int  LimiteBar;
                int  AvanceBar;
                int  CantClases;
                bool CargueIni;

                CargueIni = PreCarga.version(oConnection.oCompany);

                LimiteBar  = 20;
                CantClases = 4;
                AvanceBar  = LimiteBar / CantClases;

                //Barra de progreso en SAP

                //Creacion de tablas y campos de usuario
                if (CargueIni == true)
                {
                    oConnection.SBO_Application.StatusBar.SetText("Creacion de tablas y campos de usuario", SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
                    Tables oTables = null;
                    oTables = new Tables(oConnection.oCompany, oConnection.SBO_Application, CargueIni);
                    //oConnection.SBO_Application.StatusBar.SetText("Creacion de tablas y campos de usuario ", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
                }
                oProgBar = oConnection.SBO_Application.StatusBar.CreateProgressBar("Inicio " + "AddOnFE_DIAN", LimiteBar, true);

                oProgBar.Text   = "Cargando AddOn ... Proceso (1) ";
                oProgBar.Value += AvanceBar;
                //Creacion de menus y formularios
                MenuItem oMenus = null;
                oMenus = new MenuItem(oConnection.oCompany, oConnection.SBO_Application);
                //MenuItem oMenuReports = new MenuItem(oConnection.oCompany, oConnection.SBO_Application);

                oProgBar.Text   = "Cargando AddOn ... Proceso (2) ";
                oProgBar.Value += AvanceBar;
                //clase donde se realizan algunos procesos del addon
                Procesos oProcesos = null;
                oProcesos = new Procesos(oConnection.oCompany, oConnection.SBO_Application);

                oProgBar.Text   = "Cargando AddOn ... Proceso (3) ";
                oProgBar.Value += AvanceBar;
                //PreCarga Tablas y configuracion
                if (CargueIni == true)
                {
                    PreCarga oPreCarga = null;
                    oPreCarga = new PreCarga(oConnection.oCompany, oConnection.SBO_Application);
                }

                oProgBar.Text  = "Carga Satisfactoria " + "AddOnFE_DIAN";
                oProgBar.Value = LimiteBar;

                try
                {
                    //Finalizacion de la barra de proceso
                    oProgBar.Stop();
                }
                catch (Exception)
                {
                }
                oConnection.SBO_Application.SetStatusBarMessage("Carga Satisfactoria AddOnFE_DIAN", (SAPbouiCOM.BoMessageTime)SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                Application.Run();
            }
            catch (Exception ex)
            {
                MessageBox.Show("(70) - " + ex.Message);
            }
        }
Exemple #15
0
 public Progress(int max, string text)
 {
     progress = Conn.UI.StatusBar.CreateProgressBar(text, max, false);
 }
Exemple #16
0
 public void Dispose()
 {
     Stop();
     progress = null;
 }
        public static void DatatableSAP_a_Excel(SAPbouiCOM.DataTable DataTable)
        {
            try
            {
                SAPbouiCOM.ProgressBar oProgBar = null;
                Microsoft.Office.Interop.Excel.Application _excel = new Microsoft.Office.Interop.Excel.Application();
                Microsoft.Office.Interop.Excel._Workbook   wBook;  //= default(Microsoft.Office.Interop.Excel.Workbook);
                Microsoft.Office.Interop.Excel._Worksheet  wSheet; //= default(Microsoft.Office.Interop.Excel.Worksheet);

                wBook  = (excel.Workbook)(_excel.Workbooks.Add(""));
                wSheet = (excel.Worksheet)_excel.ActiveSheet;

                int colIndex = 0;
                int rowIndex = 0;

                // Crea Progress Bar
                try
                {
                    oProgBar = Application.SBO_Application.StatusBar.CreateProgressBar("Generando Columnas Excel", DataTable.Columns.Count, true);
                }
                catch (Exception)
                {
                }

                int ind = 0;

                for (int i = 1; i <= DataTable.Columns.Count; i++)
                {
                    colIndex = colIndex + 1;
                    _excel.Cells[1, colIndex] = DataTable.Columns.Item(i - 1).Name;
                    ind += 1;
                    // Actualiza Progress Bar
                    try
                    {
                        oProgBar.Value += 1;
                    }
                    catch (Exception)
                    {
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(oProgBar);
                        oProgBar       = null;
                        oProgBar       = Application.SBO_Application.StatusBar.CreateProgressBar("Generando Columnas Excel", DataTable.Columns.Count, true);
                        oProgBar.Value = colIndex + 1;
                    }
                }

                // Cierra Progress Bar
                try
                {
                    oProgBar.Stop();
                }
                catch (Exception)
                {
                }


                // Crea Progress Bar
                try
                {
                    oProgBar = Application.SBO_Application.StatusBar.CreateProgressBar("Generando Filas Excel", DataTable.Rows.Count, true);
                }
                catch (Exception)
                {
                }


                for (int i = 0; i <= DataTable.Rows.Count - 1; i++)
                {
                    rowIndex = rowIndex + 1;
                    colIndex = 0;

                    for (int c = 1; c <= DataTable.Columns.Count; c++)
                    {
                        colIndex = colIndex + 1;
                        _excel.Cells[rowIndex + 1, colIndex] = DataTable.GetValue(c - 1, i);
                    }

                    // Actualiza Progress Bar
                    try
                    {
                        oProgBar.Value += 1;
                    }
                    catch (Exception)
                    {
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(oProgBar);
                        oProgBar       = null;
                        oProgBar       = Application.SBO_Application.StatusBar.CreateProgressBar("Generando Filas Excel", DataTable.Rows.Count, true);
                        oProgBar.Value = rowIndex + 1;
                    }
                }

                // Cierra Progress Bar
                try
                {
                    oProgBar.Stop();
                }
                catch (Exception)
                {
                }

                wSheet.Columns.AutoFit();

                _excel.Visible     = true;
                _excel.WindowState = Microsoft.Office.Interop.Excel.XlWindowState.xlMaximized;
            }
            catch (Exception)
            {
            }

            //Dim strFileName As String = "C:\datatable.xlsx"
            //If System.IO.File.Exists(strFileName) Then
            // System.IO.File.Delete(strFileName)
            //End If

            //wBook.SaveAs(strFileName)
            //wBook.Close()
            //_excel.Quit()
        }