Amélioration : L'impression des feuilles d'émargement.
This commit is contained in:
parent
bf1a6ba1bb
commit
34edf5646c
@ -192,7 +192,7 @@
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:cy="46.440375"
|
||||
inkscape:cx="362.94484"
|
||||
inkscape:cx="257.64055"
|
||||
inkscape:zoom="1.6903395"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
@ -224,7 +224,7 @@
|
||||
inkscape:groupmode="layer"
|
||||
inkscape:label="Calque 1"><g
|
||||
id="g1186"
|
||||
transform="translate(3.3301737,32.430108)"><text
|
||||
transform="translate(3.7214843,32.195317)"><text
|
||||
xml:space="preserve"
|
||||
style="font-size:7.1582px;line-height:1.25;font-family:sans-serif;text-align:center;letter-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:url(#radialGradient1054);stroke-width:2;filter:url(#filter1511)"
|
||||
x="86.464272"
|
||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
@ -42,7 +42,7 @@ public class FileSaveXLSX {
|
||||
if (type.equals(exportBaseToExcel.exportType.TABLE))
|
||||
new CreateCalcWorkbook(data, selectedFile.getAbsolutePath());
|
||||
if (type.equals(exportBaseToExcel.exportType.EMARGEMENT))
|
||||
new createEmargement(data, selectedFile.getAbsolutePath());
|
||||
new createEmargement(data, selectedFile.getAbsolutePath(),fileChooser.getName(selectedFile));
|
||||
if (type.equals(exportBaseToExcel.exportType.BASE))
|
||||
new CreateCalcWorkbook(data, selectedFile.getAbsolutePath());
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ public class Window_demarre extends JFrame {
|
||||
});
|
||||
frmEvalwriter.getContentPane().add(btnimporterDesInscriptionsdepuisClasseur);
|
||||
|
||||
JLabel lblNewLabel_3 = new JLabel("<html>pablo rodriguez - 2023<br>Version 1.0.1</html>");
|
||||
JLabel lblNewLabel_3 = new JLabel("<html>pablo rodriguez - 2023<br>Version 1.0.2</html>");
|
||||
lblNewLabel_3.setVerticalAlignment(SwingConstants.TOP);
|
||||
lblNewLabel_3.setHorizontalAlignment(SwingConstants.LEFT);
|
||||
lblNewLabel_3.setFont(new Font("Tahoma", Font.BOLD, 15));
|
||||
|
@ -13,6 +13,7 @@ import javax.swing.JProgressBar;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingWorker;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.HeaderFooter;
|
||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
@ -38,7 +39,7 @@ public class createEmargement extends JFrame{
|
||||
JPanel panel;
|
||||
String path;
|
||||
|
||||
public createEmargement(Object[][] data, String nameFileWithPath){
|
||||
public createEmargement(Object[][] data, String nameFileWithPath, String nameFile){
|
||||
|
||||
this.path = nameFileWithPath;
|
||||
|
||||
@ -68,7 +69,7 @@ public class createEmargement extends JFrame{
|
||||
this.fr.setVisible(true);
|
||||
|
||||
|
||||
processTask = new ProcessTask(data);
|
||||
processTask = new ProcessTask(data,nameFile);
|
||||
processTask.execute();
|
||||
|
||||
this.dispose();
|
||||
@ -78,9 +79,11 @@ public class createEmargement extends JFrame{
|
||||
private class ProcessTask extends SwingWorker<Void, Integer> {
|
||||
|
||||
private Object[][] data;
|
||||
private String nameFile;
|
||||
|
||||
public ProcessTask(Object[][] data) {
|
||||
public ProcessTask(Object[][] data, String nameFile) {
|
||||
this.data = data;
|
||||
this.nameFile = nameFile;
|
||||
}
|
||||
|
||||
|
||||
@ -125,6 +128,8 @@ public class createEmargement extends JFrame{
|
||||
blueCellStyle.setFont(font1);
|
||||
|
||||
|
||||
String nameFormation = "";
|
||||
|
||||
// Définir la hauteur de la ligne 4 (1 cm)
|
||||
int heightInPoints = (int) (1 * 72 / 2.54); //1cm
|
||||
int heightInPoints2 = (int) (0.8 * 72 / 2.54); //0.8cm
|
||||
@ -132,7 +137,7 @@ public class createEmargement extends JFrame{
|
||||
for (int i = 0; i < rows; i++) {
|
||||
publish(i);
|
||||
|
||||
String nameFormation = (String) data[i][0];
|
||||
nameFormation = (String) data[i][0];
|
||||
String[][] data1 = (String[][]) data[i][columns-1];
|
||||
|
||||
Sheet sheet = workbook.createSheet(nameFormation);
|
||||
@ -203,18 +208,40 @@ public class createEmargement extends JFrame{
|
||||
|
||||
|
||||
|
||||
// Définir la largeur de la colonne B (2 cm)
|
||||
int widthInCharsB = (int) (2 * 256 / 0.146);
|
||||
//Définir la largeur de la colonne B (2 cm)
|
||||
int widthInCharsB = (int) (1.8 * 256 / 0.146);
|
||||
sheet.setColumnWidth(1, widthInCharsB);
|
||||
|
||||
// Définir la largeur de la colonne E (6 cm)
|
||||
int widthInCharsE = (int) (6 * 256 / 0.146);
|
||||
sheet.setColumnWidth(4, widthInCharsE);
|
||||
|
||||
sheet.autoSizeColumn(0);
|
||||
sheet.autoSizeColumn(2);
|
||||
sheet.autoSizeColumn(3);
|
||||
|
||||
|
||||
// // Définir la largeur de la colonne E (6 cm)
|
||||
// int widthInCharsE = (int) (6 * 256 / 0.146);
|
||||
// sheet.setColumnWidth(4, widthInCharsE);
|
||||
|
||||
// Estimer la largeur de la feuille A4 en unités de 1/256ème de caractère
|
||||
int a4WidthUnits = 22000 ; //(17 * 256)/0.146; // Largeur de la feuille A4 en unités de 1/256ème de caractère
|
||||
// int a4WidthUnits = 16250;
|
||||
// Obtenir la largeur totale des colonnes A à D en unités de 1/256ème de caractère
|
||||
int widthOfColumnsAtoD = 0;
|
||||
for (int columnIndex = 0; columnIndex < 4; columnIndex++) {
|
||||
widthOfColumnsAtoD += sheet.getColumnWidth(columnIndex);
|
||||
}
|
||||
|
||||
// Calculer la largeur restante en unités de 1/256ème de caractère
|
||||
int remainingWidthUnits = a4WidthUnits - widthOfColumnsAtoD;
|
||||
|
||||
// Définir la largeur de la colonne E en unités de 1/256ème de caractère
|
||||
sheet.setColumnWidth(4, remainingWidthUnits);
|
||||
|
||||
// Définir l'en-tête de la feuille de calcul
|
||||
sheet.getHeader().setCenter("Emargement : " + nameFile);
|
||||
|
||||
// Définir le pied de page
|
||||
sheet.getFooter().setCenter("Page " + HeaderFooter.page());
|
||||
|
||||
}
|
||||
|
||||
// Enregistrer le classeur dans un fichier
|
||||
|
Loading…
Reference in New Issue
Block a user