org.jopendocument.dom.template
Class Template

java.lang.Object
  extended by org.jopendocument.dom.template.Template

public class Template
extends Object

Generates documents merging template and data.

Sample usage:

 Template template = new Template(new FileInputStream("template.sxw"));
 Map vars = new HashMap();
 vars.put("title", "The Title");
 //...
 template.createDocument(vars, new FileOutputStream("document.sxw"));
 


Field Summary
protected  Parsed<ODPackage> contentTemplate
           
 
Constructor Summary
Template(File f)
           
Template(InputStream in)
          Loads a template from the specified input stream.
Template(ODPackage contents)
           
 
Method Summary
 ODSingleXMLDocument createDocument(DataModel engine)
           
 void createDocument(DataModel engine, OutputStream out)
          Generates a document merging template and data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contentTemplate

protected final Parsed<ODPackage> contentTemplate
Constructor Detail

Template

public Template(InputStream in)
         throws IOException,
                TemplateException
Loads a template from the specified input stream.

Parameters:
in - a stream on a ODF package.
Throws:
IOException - if the stream can't be read.
TemplateException - if the template statements are invalid.

Template

public Template(File f)
         throws IOException,
                TemplateException
Throws:
IOException
TemplateException

Template

public Template(ODPackage contents)
         throws IOException,
                TemplateException
Throws:
IOException
TemplateException
Method Detail

createDocument

public void createDocument(DataModel engine,
                           OutputStream out)
                    throws IOException,
                           TemplateException
Generates a document merging template and data.

Parameters:
engine - the data model.
out - stream the document is written to.
Throws:
IOException - si erreur de zippage.
TemplateException

createDocument

public ODSingleXMLDocument createDocument(DataModel engine)
                                   throws TemplateException
Throws:
TemplateException


Copyright © 2010 jOpenDocument All Rights Reserved.