Elle ne contient pas de formation.
", "Erreur", JOptionPane.ERROR_MESSAGE); + return; + } + int compteur = 0 ; + boolean erreur = false; + StringBuilder messageErreur = new StringBuilder(); + + try (FileInputStream fileInputStream = new FileInputStream(file.getAbsolutePath()); Workbook workbook = new XSSFWorkbook(fileInputStream)) { @@ -62,7 +69,29 @@ public class importAllBaseToExcel { boolean trouveColonneCode = false; int indexColonneFormation = 0; int indexColonneCode = 1; + int indexColonneNomEtudiant = -2; + int indexColonnePrenomEtudiant = -2; + int indexColonneGroupe_Principal = -2; + int indexColonneGroupe_TD = -2; + int indexColonneGroupe_TP = -2; + int indexColonneGroupe_Informatique = -2; + int indexColonneGroupe_Documentation = -2; + int indexColonneGroupe_Projet = -2; + int indexColonneGroupe_LV1 = -2; + int indexColonneGroupe_LV2 = -2; + boolean verouillage_Groupe_Principal = false; + boolean verouillage_Groupe_TD = false; + boolean verouillage_Groupe_TP = false; + boolean verouillage_Groupe_Informatique = false; + boolean verouillage_Groupe_Documentation = false; + boolean verouillage_Groupe_Projet = false; + boolean verouillage_Groupe_LV1 = false; + boolean verouillage_Groupe_LV2 = false; + + boolean verouillage_tous_Les_Groupe = false; + + // Première ligne de la table for (Cell cell : sheet.getRow(0)) { if(cell.getCellType()==CellType.STRING) { if(cell.getStringCellValue().equals("Formation")) { @@ -73,12 +102,42 @@ public class importAllBaseToExcel { trouveColonneCode = true; indexColonneCode = cell.getColumnIndex(); } + if(cell.getStringCellValue().equals(commandes.nomColonneNomEtudiant)) { + indexColonneNomEtudiant = cell.getColumnIndex(); + } + if(cell.getStringCellValue().equals(commandes.nomColonnePrenomEtudiant)) { + indexColonnePrenomEtudiant = cell.getColumnIndex(); + } + if(cell.getStringCellValue().equals("Groupe_Principal")) { + indexColonneGroupe_Principal = cell.getColumnIndex(); + } + if(cell.getStringCellValue().equals("Groupe_TD")) { + indexColonneGroupe_TD = cell.getColumnIndex(); + } + if(cell.getStringCellValue().equals("Groupe_TP")) { + indexColonneGroupe_TP = cell.getColumnIndex(); + } + if(cell.getStringCellValue().equals("Groupe_Informatique")) { + indexColonneGroupe_Informatique = cell.getColumnIndex(); + } + if(cell.getStringCellValue().equals("Groupe_Doc")) { + indexColonneGroupe_Documentation = cell.getColumnIndex(); + } + if(cell.getStringCellValue().equals("Groupe_Projet")) { + indexColonneGroupe_Projet = cell.getColumnIndex(); + } + if(cell.getStringCellValue().equals("Groupe_LV1")) { + indexColonneGroupe_LV1 = cell.getColumnIndex(); + } + if(cell.getStringCellValue().equals("Groupe_LV2")) { + indexColonneGroupe_LV2 = cell.getColumnIndex(); + } } } if(!trouveColonneFormation || !trouveColonneCode) { JOptionPane.showMessageDialog(null, "Il semble que ce classeur ne permettent pas" - + "