OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 19 | Rev 93 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 19 Rev 25
Line 191... Line 191...
191
                System.err.println("Modele introuvable : " + (defaultLocationTemplate + File.separator + this.modele));
191
                System.err.println("Modele introuvable : " + (defaultLocationTemplate + File.separator + this.modele));
192
                fODSP = null;
192
                fODSP = null;
193
                return null;
193
                return null;
194
            }
194
            }
195
        }
195
        }
196
        final SpreadSheet res = SpreadSheet.create(new ODPackage(f));
196
        final SpreadSheet res = new ODPackage(f).getSpreadSheet();
197
        f.close();
197
        f.close();
198
        return res;
198
        return res;
199
    }
199
    }
200
 
200
 
201
    protected File save(SpreadSheet ssheet) throws IOException {
201
    protected File save(SpreadSheet ssheet) throws IOException {
Line 248... Line 248...
248
 
248
 
249
    public SpreadSheetGenerator(SheetInterface sheet, String destFileName, boolean impr, boolean visu, boolean exportPDF) {
249
    public SpreadSheetGenerator(SheetInterface sheet, String destFileName, boolean impr, boolean visu, boolean exportPDF) {
250
 
250
 
251
        this.modele = sheet.modele;
251
        this.modele = sheet.modele;
252
        this.mCell = sheet.mCell;
252
        this.mCell = sheet.mCell;
253
        this.destDirOO = new File(sheet.locationOO);
253
        this.destDirOO = sheet.getDocumentOutputDirectory();
254
        this.destDirOO.mkdirs();
254
        this.destDirOO.mkdirs();
255
        this.destDirPDF = new File(sheet.locationPDF);
255
        this.destDirPDF = sheet.getPDFOutputDirectory();
256
        this.destDirPDF.mkdirs();
256
        this.destDirPDF.mkdirs();
257
        this.nbPage = sheet.nbPage;
257
        this.nbPage = sheet.nbPage;
258
        this.nbRowsPerPage = sheet.nbRowsPerPage;
258
        this.nbRowsPerPage = sheet.nbRowsPerPage;
259
        this.destFileName = destFileName;
259
        this.destFileName = destFileName;
260
        this.mapStyleRow = sheet.mapStyleRow;
260
        this.mapStyleRow = sheet.mapStyleRow;
Line 270... Line 270...
270
    public void run() {
270
    public void run() {
271
        File f = null;
271
        File f = null;
272
        try {
272
        try {
273
 
273
 
274
            f = generateWithStyle();
274
            f = generateWithStyle();
275
 
-
 
-
 
275
            final File pdfFileToCreate = new File(this.destDirPDF.getAbsolutePath(), this.destFileName + ".pdf");
276
            try {
276
            try {
277
 
277
 
278
                if (!Boolean.getBoolean("org.openconcerto.oo.useODSViewer")) {
278
                if (!Boolean.getBoolean("org.openconcerto.oo.useODSViewer")) {
279
 
279
 
280
                    final Component doc = ComptaPropsConfiguration.getOOConnexion().loadDocument(f, !this.visu);
280
                    final Component doc = ComptaPropsConfiguration.getOOConnexion().loadDocument(f, !this.visu);
281
                    if (this.exportPDF) {
281
                    if (this.exportPDF) {
-
 
282
 
282
                        doc.saveToPDF(new File(this.destDirPDF.getAbsolutePath(), this.destFileName + ".pdf"));
283
                        doc.saveToPDF(pdfFileToCreate);
283
                    }
284
                    }
284
 
285
 
285
                    if (this.impression) {
286
                    if (this.impression) {
286
                        Map<String, Object> map = new HashMap<String, Object>();
287
                        Map<String, Object> map = new HashMap<String, Object>();
287
                        map.put("Name", this.printer);
288
                        map.put("Name", this.printer);
Line 293... Line 294...
293
                    final OpenDocument doc = new OpenDocument(f);
294
                    final OpenDocument doc = new OpenDocument(f);
294
                    if (this.visu) {
295
                    if (this.visu) {
295
                        PreviewFrame.show(f);
296
                        PreviewFrame.show(f);
296
                    }
297
                    }
297
 
298
 
298
                    SheetUtils.getInstance().convert2PDF(doc, f, this.destFileName);
299
                    SheetUtils.convert2PDF(doc, pdfFileToCreate);
299
                    if (this.impression) {
300
                    if (this.impression) {
300
                        // Print !
301
                        // Print !
301
                        DefaultNXDocumentPrinter printer = new DefaultNXDocumentPrinter();
302
                        DefaultNXDocumentPrinter printer = new DefaultNXDocumentPrinter();
302
                        printer.print(doc);
303
                        printer.print(doc);
303
                    }
304
                    }