Beispiel #1
0
        void InsertionLien()
        {
            ClassePHP cls = new ClassePHP();
            string    sql = "";
            int       n   = 0;

            List <Lien> ListeLien = Acces.Remplir_ListeLien_Niv0(Acces.type_PLAN, "");

            lst.Items.Add("Insertion Table Lien..." + ListeLien.Count().ToString());
            Application.DoEvents();

            Acces.Remplir_ListeElement(Acces.type_PLAN, "");
            List <Plan> listeplan = (List <Plan>)Acces.Remplir_ListeElement(Acces.type_PLAN, "");

            //Insertion des données

            foreach (Lien p in ListeLien)
            {
                //lst.Items.Add("Lien : " + p.Element1_Code + "-" + p.Element2_Code);
                Application.DoEvents();

                int    elementid0 = 0; int elementid1 = 0; int elementid2 = 0;
                string typeelement0  = DonneValeur("TYPE_ELEMENT", Acces.type_PLAN.Code, ref elementid0);
                string Element1_Type = DonneValeur("TYPE_ELEMENT", Acces.Trouver_TableValeur(p.Element1_Type).Code, ref elementid1);
                string Element2_Type = DonneValeur("TYPE_ELEMENT", Acces.Trouver_TableValeur(p.Element2_Type).Code, ref elementid2);

                sql  = "INSERT INTO lien (Element0_Type, Element0_Code, Element0_ID, Element1_Type, Element1_ID, Element1_Code,";
                sql += " Element2_Type, Element2_ID, Element2_Code, ordre, complement) VALUES (";
                sql += "'" + typeelement0 + "',";
                sql += "'" + DonneCodePlan(p.Element0_ID, listeplan) + "',";
                sql += "'" + p.Element0_ID + "',";
                sql += "'" + Element1_Type + "',";
                sql += "'" + p.Element1_ID + "',";
                sql += "'" + p.Element1_Code + "',";
                sql += "'" + Element2_Type + "',";
                sql += "'" + p.Element2_ID + "',";
                sql += "'" + p.Element2_Code + "',";
                sql += "'" + p.ordre + "',";
                sql += "'" + p.complement + "')";

                cls = new ClassePHP();
                cls.Execute(sql);
                if (cls.erreur.Length > 0)
                {
                    lst.Items.Add("Erreur : " + p.Element1_Code + "-" + p.Element2_Code);
                }
                else
                {
                    n++;
                }
            }

            lst.Items.Add(n + " lignes Table Lien...");
        }
Beispiel #2
0
        /// <summary>
        /// Repositionne les éléments selon la hiérarchie définie
        /// </summary>
        void Repositionner(Plan plan)
        {
            int nbObjectif = 0; int nbAction = 0; int nbOpération = 0; int nbIndicateur = 0;

            //Placement des objectifs/sous-objectifs
            listeLien = Acces.Remplir_ListeLien_Niv0(Acces.type_PLAN, plan.ID.ToString());
            listeLien.Sort();

            //On balaye la liste des éléments
            //On crée l'élément sous le parent
            foreach (var p in listeLien)
            {
                //Recherche du parent
                string   Parent    = Acces.Trouver_TableValeur(p.Element1_Type).Code + "-" + p.Element1_ID.ToString();
                TreeNode NodParent = NodG;

                if (!(Parent == NodG.Name))
                {
                    TreeNode[] NodP = NodG.Nodes.Find(Parent, true);
                    if (NodP.Length > 0)
                    {
                        NodParent = NodP[0];
                    }
                }

                string Enfant = Acces.Trouver_TableValeur(p.Element2_Type).Code + "-" + p.Element2_ID.ToString();
                if (!(Enfant is null))
                {
                    Boolean Ajoute = true;
                    //Création de l'élément enfant
                    TreeNode NodEnfant = new TreeNode()
                    {
                        Name = Enfant,
                        Tag  = p,
                    };

                    if (p.Element2_Type == Acces.type_OBJECTIF.ID)
                    //if (p.Element2_Type == Acces.Trouver_TableValeur_ID("TYPE_ELEMENT", p.Element1_Type.ToString()))
                    {
                        Objectif q = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF, p.Element2_ID);
                        if (!(q is null))
                        {
                            NodEnfant.Text        = q.Libelle;
                            NodEnfant.Name        = Acces.type_OBJECTIF.Code + "-" + q.ID;
                            NodEnfant.ImageIndex  = Donner_ImageIndex(Acces.type_OBJECTIF, p.Element2_ID);
                            NodEnfant.ToolTipText = q.Code;
                            nbObjectif++;
                        }
                        else
                        {
                            Console.Ajouter("[Objectif non trouvé] ID:" + p.Element2_ID + " Code :" + p.Element2_Code);
                        }
                    }

                    if (p.Element2_Type == Acces.type_ACTION.ID)
                    {
                        PATIO.CAPA.Classes.Action q = (PATIO.CAPA.Classes.Action)Acces.Trouver_Element(Acces.type_ACTION, p.Element2_ID);
                        if (!(q is null))
                        {
                            NodEnfant.Text       = q.Libelle;
                            NodEnfant.Name       = Acces.type_ACTION.Code + "-" + q.ID;
                            NodEnfant.ImageIndex = Donner_ImageIndex(Acces.type_ACTION, p.Element2_ID);
                            if (q.ActionPhare)
                            {
                                NodEnfant.ImageIndex = imgs[PosImageActionPhare].Id;
                            }
                            NodEnfant.ToolTipText = q.Code + " [" + p.ordre + "]";
                            if (q.TypeAction == TypeAction.ACTION)
                            {
                                nbAction++;
                            }
                            if (q.TypeAction == TypeAction.OPERATION)
                            {
                                nbOpération++;
                            }
                        }
                        else
                        {
                            Console.Ajouter("[Action non trouvée] ID:" + p.Element2_ID + " CODE:" + p.Element2_Code);
                        }
                    }

                    if (p.Element2_Type == Acces.type_INDICATEUR.ID)
                    {
                        Indicateur q = (Indicateur)Acces.Trouver_Element(Acces.type_INDICATEUR, p.Element2_ID);
                        if (!(q is null))
                        {
                            NodEnfant.Text        = q.Libelle;
                            NodEnfant.Name        = Acces.type_INDICATEUR.Code + "-" + q.ID;
                            NodEnfant.ImageIndex  = Donner_ImageIndex(Acces.type_INDICATEUR, p.Element2_ID);
                            NodEnfant.ToolTipText = q.Code;
                            nbIndicateur++;
                        }
                        else
                        {
                            Console.Ajouter("[Indicateur non trouvée] ID:" + p.Element2_ID + " CODE:" + p.Element2_Code);
                        }
                    }
Beispiel #3
0
        /// <summary>
        /// Edition de la fiche pour un plan
        /// </summary>
        public string Editer_Fiche_Plan()
        {
            //Création de l'application Excel
            app = new Microsoft.Office.Interop.Excel.Application();
            app.DisplayAlerts = false;

            Plan plan = (Plan)Acces.Trouver_Element(Acces.type_PLAN, id_element);

            var modele  = Chemin + "\\Modeles\\Fiche_PLAN.xltx";
            var fichier = Chemin + "\\Fichiers\\" + "FP-" + plan.Code + "-" + string.Format("{0:yyMMddHHmmss}", DateTime.Now);

            app.Workbooks.Open(modele);

            Workbooks wk = app.Workbooks;
            Workbook  wb = app.ActiveWorkbook;
            Worksheet ws = wb.Sheets[1];
            Range     r;

            r       = ws.Cells[2, 4];
            r.Value = plan.Libelle;
            r       = ws.Cells[3, 4];
            if (plan.Pilote != null)
            {
                r.Value = plan.Pilote.Nom + " " + plan.Pilote.Prenom;
            }
            r       = ws.Cells[4, 4];
            r.Value = Acces.Donner_Chaine_Liste_Utilisateur(plan.Equipe);; //Groupe interne
            r       = ws.Cells[5, 4];
            r.Value = plan.GroupeExterne;                                  //Groupe externe
            r       = ws.Cells[6, 4];
            r.Value = string.Format("{0:dd/MM/yyyy}", DateTime.Now);       //Groupe interne
            r       = ws.Cells[6, 14];
            r.Value = plan.Code;

            //Affichage des éléments
            int n_ligne = 10;

            //Efface la zone
            ws.Range["A11:Z10000"].Clear();

            List <Lien> listeLien = Acces.Remplir_ListeLien_Niv0(Acces.type_PLAN, plan.ID.ToString());

            listeLien.Sort();

            //Passe 1 : les objectifs
            foreach (Lien l in listeLien)
            {
                if (l.Element2_Type != Acces.type_OBJECTIF.ID)
                {
                    goto Suite1;
                }

                Objectif obj = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF, l.Element2_ID);

                n_ligne++;
                r       = ws.Cells[n_ligne, 1];
                r.Value = obj._op;
                r       = ws.Cells[n_ligne, 2];
                r.Value = obj.Libelle;

                r       = ws.Cells[n_ligne, 22];
                r.Value = obj.Code.Replace("OBJ-", "");
                Suite1 :;
            }

            //Passe 2 : les actions
            foreach (Lien l in listeLien)
            {
                if (l.Element2_Type != Acces.type_ACTION.ID)
                {
                    goto Suite2;
                }

                PATIO.CAPA.Classes.Action action = (PATIO.CAPA.Classes.Action)Acces.Trouver_Element(Acces.type_ACTION, l.Element2_ID);

                if (action.TypeAction != TypeAction.ACTION)
                {
                    goto Suite2;
                }
                n_ligne++;
                r       = ws.Cells[n_ligne, 3];
                r.Value = action.Libelle;

                r = ws.Cells[n_ligne, 4];
                string pilote = "";
                pilote  = Acces.Donner_Chaine_Liste(action.DirectionPilote, "DIRECTION_METIER", "", true);
                pilote += (action.Pilote != null) ? "\n" + action.Pilote.Nom + " " + action.Pilote.Prenom : plan.Pilote.Nom + " " + plan.Pilote.Prenom;
                r.Value = pilote;

                r       = ws.Cells[n_ligne, 7];
                r.Value = (action.ActionPhare ? "X" : "");
                if (action.OrdreActionPhare > 0)
                {
                    r.Value = Acces.Trouver_TableValeur(action.OrdreActionPhare).Valeur;
                }

                r = ws.Cells[n_ligne, 8]; //Année 2018
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2018", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2018;
                r = ws.Cells[n_ligne, 9]; //Année 2019
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2019", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2019;
                r = ws.Cells[n_ligne, 10]; //Année 2020
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2020", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2020;
                r = ws.Cells[n_ligne, 11]; //Année 2021
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2021", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2021;
                r = ws.Cells[n_ligne, 12]; //Année 2022
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2022", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2022;
                r = ws.Cells[n_ligne, 13]; //Année 2023
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2023", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2023;
                r       = ws.Cells[n_ligne, 14]; //Financement
                r.Value = action.CoutFinancier;
                if (action.Mt_Total != null)
                {
                    if (action.Mt_Total.Length > 0)
                    {
                        r.Value += "\n TOTAL : " + action.Mt_Total + " k€";
                    }
                }

                r                = ws.Cells[n_ligne, 15]; //TDS MF
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS591") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_591", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 16]; //TDS Hainaut
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS592") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_592", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 17]; //TDS 62
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS62") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_62", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 18]; //TDS 80
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS80") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_80", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 19]; //TDS 60
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS60") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_60", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 20]; //TDS 02
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS02") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_02", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 21]; //REGION
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "REGION", "") ? "X" : "";

                r       = ws.Cells[n_ligne, 22];
                r.Value = action.Code.Replace("ACT-", "");
                Suite2 :;
            }

            //Passe 3 : les opérations
            foreach (Lien l in listeLien)
            {
                if (l.Element2_Type != Acces.type_ACTION.ID)
                {
                    goto Suite3;
                }

                PATIO.CAPA.Classes.Action action = (PATIO.CAPA.Classes.Action)Acces.Trouver_Element(Acces.type_ACTION, l.Element2_ID);

                if (action.TypeAction != TypeAction.OPERATION)
                {
                    goto Suite3;
                }
                n_ligne++;
                r       = ws.Cells[n_ligne, 5];
                r.Value = action.Libelle;

                r = ws.Cells[n_ligne, 6];
                string pilote = "";
                pilote  = Acces.Donner_Chaine_Liste(action.DirectionPilote, "DIRECTION_METIER", "", true);
                pilote += (action.Pilote != null) ? "\n" + action.Pilote.Nom + " " + action.Pilote.Prenom : plan.Pilote.Nom + " " + plan.Pilote.Prenom;
                r.Value = pilote;

                r       = ws.Cells[n_ligne, 7];
                r.Value = (action.ActionPhare ? "X" : "");
                if (action.OrdreActionPhare > 0)
                {
                    r.Value = Acces.Trouver_TableValeur(action.OrdreActionPhare).Valeur;
                }

                r = ws.Cells[n_ligne, 8]; //Année 2018
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2018", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2018;
                r = ws.Cells[n_ligne, 9]; //Année 2019
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2019", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2019;
                r = ws.Cells[n_ligne, 10]; //Année 2020
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2020", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2020;
                r = ws.Cells[n_ligne, 11]; //Année 2021
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2021", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2021;
                r = ws.Cells[n_ligne, 12]; //Année 2022
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2022", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2022;
                r = ws.Cells[n_ligne, 13]; //Année 2023
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2023", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2023;
                r       = ws.Cells[n_ligne, 14]; //Financement
                r.Value = action.CoutFinancier;
                if (action.Mt_Total != null)
                {
                    if (action.Mt_Total.Length > 0)
                    {
                        r.Value += "\n TOTAL : " + action.Mt_Total + " k€";
                    }
                }

                r                = ws.Cells[n_ligne, 15]; //TDS MF
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS591") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_591", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 16]; //TDS Hainaut
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS592") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_592", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 17]; //TDS 62
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS62") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_62", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 18]; //TDS 80
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS80") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_80", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 19]; //TDS 60
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS60") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_60", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 20]; //TDS 02
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS02") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_02", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 21]; //REGION
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "REGION", "") ? "X" : "";

                //Définition de l'ordre : différent d'action car la structure diffère avec les directions métier
                r = ws.Cells[n_ligne, 22];
                PATIO.CAPA.Classes.Action parent = (PATIO.CAPA.Classes.Action)Acces.Trouver_Element(Acces.type_ACTION, l.Element1_ID);
                string ordre = parent.Code.Replace("ACT-", "") + "-" + string.Format("{0:x3}", l.ordre);
                r.Value = ordre;
                //r.Value = action.Code.Replace("OPE-", "");
                Suite3 :;
            }

            //Tri des lignes
            Range r_data = ws.Range["A11:W" + n_ligne];

            r_data.Sort(r_data.Columns[22, Type.Missing], Microsoft.Office.Interop.Excel.XlSortOrder.xlAscending);

            r_data.Cells.VerticalAlignment = XlVAlign.xlVAlignCenter;

            //Mise en forme
            {
                r_data.WrapText = true; //Renvoie à la ligne
                //Bordures
                Borders border = r_data.Borders;

                border.LineStyle = XlLineStyle.xlContinuous;
                border.Weight    = 2d;
                border[XlBordersIndex.xlEdgeLeft].LineStyle   = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                border[XlBordersIndex.xlEdgeTop].LineStyle    = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                border[XlBordersIndex.xlEdgeBottom].LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                border[XlBordersIndex.xlEdgeRight].LineStyle  = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;

                //Alignement
                ws.Columns[1].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[4].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[6].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[7].HorizontalAlignment = XlHAlign.xlHAlignCenter;

                ws.Columns[8].HorizontalAlignment  = XlHAlign.xlHAlignCenter;
                ws.Columns[9].HorizontalAlignment  = XlHAlign.xlHAlignCenter;
                ws.Columns[10].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[11].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[12].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[13].HorizontalAlignment = XlHAlign.xlHAlignCenter;

                ws.Columns[15].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[16].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[17].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[18].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[19].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[20].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[21].HorizontalAlignment = XlHAlign.xlHAlignCenter;

                //Colonnes masquées
                ws.Columns["A"].Hidden = true;
                ws.Columns["V"].Hidden = true;
            }

            //Sauvegarde du fichier
            wb.SaveAs(fichier + ".xlsx");
            wb.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF, fichier + ".pdf");

            wb.Close(false);
            wk.Close();

            //Fermeture de l'application Excel
            app.Quit();
            app = null;

            if (OuvertureAuto)
            {
                OuvertureFichier(fichier + ".pdf");
            }

            return(fichier);
        }