OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 182 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 182 Rev 185
Line 206... Line 206...
206
            if (meta != null) {
206
            if (meta != null) {
207
                meta.applyTo(spreadSheet.getPackage().getMeta(true));
207
                meta.applyTo(spreadSheet.getPackage().getMeta(true));
208
            }
208
            }
209
 
209
 
210
            // Sauvegarde du fichier
210
            // Sauvegarde du fichier
211
            return saveSpreadSheet(spreadSheet, outputDirectory, expectedFileName, templateId, rowLanguage);
211
            return saveSpreadSheet(spreadSheet, outputDirectory, expectedFileName, templateId, rowLanguage, typeTemplate);
212
 
212
 
213
        } catch (final JDOMException e) {
213
        } catch (final JDOMException e) {
214
 
214
 
215
            e.printStackTrace();
215
            e.printStackTrace();
216
            SwingUtilities.invokeLater(new Runnable() {
216
            SwingUtilities.invokeLater(new Runnable() {
Line 989... Line 989...
989
     * @param fileName nom du fichier à créer
989
     * @param fileName nom du fichier à créer
990
     * @return un File pointant sur le fichier créé
990
     * @return un File pointant sur le fichier créé
991
     * @throws IOException
991
     * @throws IOException
992
     */
992
     */
993
 
993
 
994
    private static File saveSpreadSheet(SpreadSheet ssheet, File pathDest, String fileName, String templateId, SQLRow rowLanguage) throws IOException {
994
    private static File saveSpreadSheet(SpreadSheet ssheet, File pathDest, String fileName, String templateId, SQLRow rowLanguage, String type) throws IOException {
995
        final String langage = rowLanguage != null ? rowLanguage.getString("CHEMIN") : null;
995
        final String langage = rowLanguage != null ? rowLanguage.getString("CHEMIN") : null;
996
        // Test des arguments
996
        // Test des arguments
997
        if (ssheet == null || pathDest == null || fileName.trim().length() == 0) {
997
        if (ssheet == null || pathDest == null || fileName.trim().length() == 0) {
998
            throw new IllegalArgumentException();
998
            throw new IllegalArgumentException();
999
        }
999
        }
Line 1025... Line 1025...
1025
            e.printStackTrace();
1025
            e.printStackTrace();
1026
        }
1026
        }
1027
 
1027
 
1028
        // Copie de l'odsp
1028
        // Copie de l'odsp
1029
        File odspOut = new File(pathDest, fileName + ".odsp");
1029
        File odspOut = new File(pathDest, fileName + ".odsp");
1030
        try (final InputStream odspIn = TemplateManager.getInstance().getTemplatePrintConfiguration(templateId, langage, null);) {
1030
        try (final InputStream odspIn = TemplateManager.getInstance().getTemplatePrintConfiguration(templateId, langage, type);) {
1031
            if (odspIn != null) {
1031
            if (odspIn != null) {
1032
                StreamUtils.copy(odspIn, odspOut);
1032
                StreamUtils.copy(odspIn, odspOut);
1033
            }
1033
            }
1034
        } catch (FileNotFoundException e) {
1034
        } catch (FileNotFoundException e) {
1035
            System.err.println("OOgenerationXML.saveSpreadSheet() : Le fichier odsp n'existe pas.");
1035
            System.err.println("OOgenerationXML.saveSpreadSheet() : Le fichier odsp n'existe pas.");