OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 17 Rev 180
Line 35... Line 35...
35
 * vars.put("title", "The Title");
35
 * vars.put("title", "The Title");
36
 * //...
36
 * // ...
37
 * template.createDocument(vars, new FileOutputStream("document.sxw"));
37
 * template.createDocument(vars, new FileOutputStream("document.sxw"));
38
 * </pre>
38
 * </pre>
39
 */
39
 */
40
public class Template {
40
public class Template implements AutoCloseable {
41
 
41
 
42
    protected final Parsed<ODPackage> contentTemplate;
42
    protected final Parsed<ODPackage> contentTemplate;
43
 
43
 
44
    /**
44
    /**
45
     * Loads a template from the specified input stream.
45
     * Loads a template from the specified input stream.
Line 60... Line 60...
60
        // createDocument needs ODSingleXMLDocument
60
        // createDocument needs ODSingleXMLDocument
61
        contents.toSingle();
61
        contents.toSingle();
62
        this.contentTemplate = new Parsed<ODPackage>(Material.from(contents));
62
        this.contentTemplate = new Parsed<ODPackage>(Material.from(contents));
63
    }
63
    }
64
 
64
 
-
 
65
    @Override
-
 
66
    public void close() throws Exception {
-
 
67
        this.contentTemplate.destroy();
-
 
68
    }
-
 
69
 
65
    /**
70
    /**
66
     * Generates a document merging template and data.
71
     * Generates a document merging template and data.
67
     * 
72
     * 
68
     * @param engine the data model.
73
     * @param engine the data model.
69
     * @param out stream the document is written to.
74
     * @param out stream the document is written to.