MAJ V1.0.1 (JRE1.8 with JDK 1.8.0_271)
This commit is contained in:
parent
11690632e2
commit
a7a94a4732
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
|
@ -21,9 +21,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
|
||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
@ -126,6 +126,6 @@ org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
|
||||
org.eclipse.jdt.core.incompleteClasspath=error
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
L2 Histoire.xlsx
BIN
L2 Histoire.xlsx
Binary file not shown.
Binary file not shown.
@ -4,7 +4,6 @@ import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
@ -34,11 +33,11 @@ public class CreateCalcWorkbook extends JFrame{
|
||||
private ProcessTask processTask;
|
||||
private JFrame fr;
|
||||
JPanel panel;
|
||||
String nameFile;
|
||||
String path;
|
||||
|
||||
public CreateCalcWorkbook(Object[][] data, String nameFile){
|
||||
public CreateCalcWorkbook(Object[][] data, String nameFileWithPath){
|
||||
|
||||
this.nameFile = nameFile;
|
||||
this.path = nameFileWithPath;
|
||||
|
||||
this.fr = new JFrame();
|
||||
this.fr.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
@ -85,8 +84,7 @@ public class CreateCalcWorkbook extends JFrame{
|
||||
|
||||
@Override
|
||||
protected Void doInBackground() throws Exception {
|
||||
String filePath = Paths.get("").toAbsolutePath().toString()+ "/"+ nameFile +".xlsx";
|
||||
|
||||
|
||||
try (Workbook workbook = new XSSFWorkbook()) {
|
||||
int rows = data.length; // Nombre de lignes
|
||||
int columns = data[0].length;
|
||||
@ -143,7 +141,7 @@ public class CreateCalcWorkbook extends JFrame{
|
||||
}
|
||||
|
||||
// Enregistrer le classeur dans un fichier
|
||||
FileOutputStream fileOut = new FileOutputStream(filePath);
|
||||
FileOutputStream fileOut = new FileOutputStream(path);
|
||||
workbook.write(fileOut);
|
||||
fileOut.close();
|
||||
|
||||
|
44
src/baseUFRHG/FileSaveXLSX.java
Normal file
44
src/baseUFRHG/FileSaveXLSX.java
Normal file
@ -0,0 +1,44 @@
|
||||
package baseUFRHG;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
public class FileSaveXLSX {
|
||||
Object[][] data = null;
|
||||
String Formation = "";
|
||||
|
||||
public void chooseDestination(Object[][] data, String Formation) {
|
||||
this.data = data;
|
||||
this.Formation = Formation;
|
||||
|
||||
// Créer une boîte de dialogue de sélection de fichier
|
||||
JFileChooser fileChooser = new JFileChooser();
|
||||
|
||||
// Afficher uniquement les dossiers (et non les fichiers)
|
||||
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
|
||||
// Afficher la boîte de dialogue de sélection de fichier
|
||||
int result = fileChooser.showSaveDialog(null);
|
||||
|
||||
// Vérifier si l'utilisateur a sélectionné un dossier de destination
|
||||
if (result == JFileChooser.APPROVE_OPTION) {
|
||||
// Récupérer le dossier sélectionné par l'utilisateur
|
||||
File selectedFolder = fileChooser.getSelectedFile();
|
||||
|
||||
// Récupérer le nom du fichier à partir d'une boîte de dialogue
|
||||
String fileName = JOptionPane.showInputDialog(null, "Nom du fichier :", Formation);
|
||||
|
||||
// Créer le chemin complet du fichier en combinant le dossier et le nom du fichier
|
||||
String filePath = selectedFolder.getAbsolutePath() + File.separator + fileName + ".xlsx";
|
||||
|
||||
new CreateCalcWorkbook(data,filePath);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -36,6 +36,10 @@ public class demarre extends JFrame {
|
||||
}
|
||||
|
||||
public demarre() {
|
||||
commandes.nBase = recupeBases.recupeLaBase();
|
||||
|
||||
|
||||
|
||||
initialize();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package baseUFRHG;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
@ -90,7 +92,7 @@ public class exportBaseToExcel {
|
||||
}
|
||||
|
||||
if(data.length>0) {
|
||||
new CreateCalcWorkbook(data,"Base");
|
||||
new CreateCalcWorkbook(data, Paths.get("").toAbsolutePath().toString()+ "/Base.xlsx");
|
||||
}else {
|
||||
JPanel panel = new JPanel();
|
||||
JLabel message = new JLabel("<html><p>La base de données est nulle.</p></html>");
|
||||
@ -181,7 +183,12 @@ public class exportBaseToExcel {
|
||||
|
||||
|
||||
if(data.length>0) {
|
||||
new CreateCalcWorkbook(data,formation);
|
||||
|
||||
|
||||
FileSaveXLSX s = new FileSaveXLSX();
|
||||
s.chooseDestination(data, formation);
|
||||
|
||||
|
||||
}else {
|
||||
JPanel panel = new JPanel();
|
||||
JLabel message = new JLabel("<html><p>La base de données est nulle.</p></html>");
|
||||
|
@ -33,7 +33,8 @@ public class lecture {
|
||||
|
||||
|
||||
// ajoute les étudiants qui n'existent pas, dans la base.
|
||||
nBase = majBase.addStudents(nBase,noeudCSV);
|
||||
commandes.nBase = majBase.addStudents(nBase,noeudCSV);
|
||||
|
||||
}else {
|
||||
JPanel panel = new JPanel();
|
||||
JLabel message = new JLabel("<html><p>La base de données est nulle.</p></html>");
|
||||
|
Loading…
Reference in New Issue
Block a user