public string ReadExcelFile(string FileName)
        {
            bool ConfigExist = true;

            xmlConfigInputExcelFile = SingleSessionConfig.Instance().GetXmlConfigInputExcelFile();

            if (xmlConfigInputExcelFile == null || xmlConfigInputExcelFile.ColInfos == null)
            {
                xmlConfigInputExcelFile = new XmlConfigInputExcelFile()
                {
                    ColInfos = new List <ColInfo>(), NbCol = 0, FamilleName = "", ConfigOKForUpdateArticle = false
                };
                ConfigExist = false;
            }

            //this.xmlConfigInputExcelFile = xmlConfigInputExcelFile;
            int NumOnglet = 1;

            lastStatutFichier = new StatutFichier()
            {
                ListExcellLine = new List <ExcelLine>(), ListeColonnes = new List <ExcelColonne>(), ChampsColonnes = new List <string>()
            };

            try {
                FileInfo template = new FileInfo(FileName);
                using (ExcelPackage xlPackage = new ExcelPackage(template)) {
                    ExcelWorksheet worksheet = xlPackage.Workbook.Worksheets[NumOnglet];

                    // Calcul du nombre de ligne consécutives
                    int    RowBase = 1;
                    string sValeur = "";
                    do
                    {
                        sValeur = worksheet.Cell(RowBase, 1).Value;
                        RowBase++;
                    }while (!string.IsNullOrEmpty(sValeur));

                    // calcul du nombre de colonnes
                    int ColBase = 1;
                    do
                    {
                        sValeur = worksheet.Cell(1, ColBase).Value;
                        ColBase++;
                    }while (!string.IsNullOrEmpty(sValeur));

                    RowBase--;
                    ColBase--;
                    lastStatutFichier.NbRow = RowBase;
                    lastStatutFichier.NbCol = ColBase;

                    for (int row = 1; row < RowBase; row++)
                    {
                        var line = new ExcelLine()
                        {
                            LineRow = row, listValues = new List <string>(), listValuesExtended = new List <ValueExtended>()
                        };
                        for (int col = 1; col < ColBase; col++)
                        {
                            string varCellule = worksheet.Cell(row, col).Value;
                            if (string.IsNullOrEmpty(varCellule))
                            {
                                //varCellule = "___";
                            }
                            if (row == 1)
                            {
                                ExcelColonne excelColonne = new ExcelColonne()
                                {
                                    Nom = varCellule, NumColonne = col
                                };
                                lastStatutFichier.ListeColonnes.Add(excelColonne);
                                lastStatutFichier.ChampsColonnes.Add(varCellule);  // old..
                            }
                            else
                            {
                                line.listValues.Add(varCellule);
                                ValueExtended valueExtended = new ValueExtended()
                                {
                                    PosCol = col, Value = varCellule
                                };
                                line.listValuesExtended.Add(valueExtended);
                            }
                        }
                        lastStatutFichier.ListExcellLine.Add(line);
                    }

                    if (ConfigExist)   // Test si compatibilité du fichier excel avec Config Fichier
                    {
                        lastStatutFichier.Message = "Config excel available : ";
                        lastStatutFichier.ConfigOKForUpdateArticle = xmlConfigInputExcelFile.ConfigOKForUpdateArticle;
                        if (xmlConfigInputExcelFile.NbCol != lastStatutFichier.NbCol)
                        {
                            lastStatutFichier.Erreur   = true;
                            lastStatutFichier.Message += "Col Number not match with config";
                        }
                        else
                        {
                            int NbreDifference = 0;
                            for (int i = 0; i < lastStatutFichier.NbCol; i++)
                            {
                                if (xmlConfigInputExcelFile.ColInfos[i].ColName != lastStatutFichier.ListeColonnes[i].Nom)
                                {
                                    NbreDifference++;
                                }
                            }
                            if (NbreDifference > 0)
                            {
                                lastStatutFichier.Erreur   = true;
                                lastStatutFichier.Message += "Col Name not match with config";
                            }
                        }

                        if (!lastStatutFichier.Erreur)
                        {
                            // SI tout est OK..
                            lastStatutFichier.Message += "Erreur sur xmlConfigInputExcelFile ( a regènèrer)";
                        }
                    }
                    else
                    {
                        lastStatutFichier.Message        = "Config excel NOT available : Creation xmlConfigInputExcelFile ";
                        xmlConfigInputExcelFile.NbCol    = lastStatutFichier.NbCol;
                        xmlConfigInputExcelFile.ColInfos = new List <ColInfo>();
                        foreach (var v in lastStatutFichier.ListeColonnes)
                        {
                            xmlConfigInputExcelFile.ColInfos.Add(new ColInfo()
                            {
                                ColPosition = v.NumColonne, ColName = v.Nom, ToArticleCodeCritere = "", ToArticleNomCritere = "", ToArticleTypeCritere = 0, IsCritereFamille = false, IsMandatory = true
                            });
                        }
                    }
                }
            }
            catch (Exception ex) {
                GlobalLog.Instance().AjouteLog("SingleExcel", "ReadExcelFile ex :" + ex.Message);
            }
            return(lastStatutFichier.Message);
        }
 protected SingleExcel()
 {
     lastStatutFichier = new StatutFichier();
 }