WordTemplate Class open setLocale setDataSource process save |
WordTemplate.Process Method |
public void process
()
The process
method enters data source values in a template's
merge fields, and creates an image of the output file (the new spreadsheet) in memory.
The save method can then save the output file to disk, stream it to the browser, or both.
Call process
after setDataSource
and before save.
You can call process
more than once for a single instance of
WordTemplate. This allows you to generate multiple
files from a single template and an updated data source.
process
will throw this exception if the template is not open,
if the data source is not set, or if another error occurs. oWW = new WordTemplate();
ServletContext ctx = this.getServletContext();
iStream = new BufferedInputStream(ctx.getResourceAsStream(templateFile));
oWW.open(iStream);
oWW.setDataSource(arrValue, arrName);
//--- Call WordTemplate.process() to populate the template with
//--- the new data.
oWW.process();
oWW.save(response, "StringVarOutput.doc", false);
WordTemplate Class open setLocale setDataSource process save |