WordTemplate Class open setLocale setDataSource process save |
WordTemplate.save Method |
save(java.lang.String outputFileName)
Saves the generated Word file on the server.
|
save(java.io.OutputStream outputStream)
Writes the generated Word file to the specified output stream.
|
save(javax.servlet.http.HttpServletResponse response)
Streams the generated Word file to the client.
|
save(javax.servlet.http.HttpServletResponse response,
java.lang.String attachmentName, boolean openInBrowser)
Streams the generated Word file to the client.
|
public void save
(java.lang.String outputFileName)
Saves the generated Word file on the server.
You can call save
more than once for a single instance of
WordTemplate. This allows you to save more than one copy
of a generated file, and/or both save the file and stream it to the browser.
Using multiple process and save
calls,
you can generate multiple files from a single template and an updated data source.
outputFileName
save
will throw this exception if the output file cannot be
created or opened for writing.save
will throw this exception if outputFileName
is null
.save
will throw this exception if a fatal error occurs. oWW = new WordTemplate();
ServletContext ctx = this.getServletContext();
oWW.open(ctx.getRealPath("/WordWriterTemplates/Template1.doc"));
oWW.setDataSource(arrValue, arrName);
oWW.process();
oWW.save("C:\WordWriterOutput\Output1.xls");
public void save
(java.io.OutputStream outputStream)
Sends the generated Word binary file to the specified
java.io.OutputStream
.
You can call save
more than once for a single instance of
WordTemplate. This allows you to save more than one copy
of a generated file, and/or both save the file and stream it to the browser.
Using multiple process and save
calls,
you can generate multiple files from a single template and an updated data source.
outputStream
save
will throw this exception if outputStream
is null
.save
will throw this exception if a fatal error occurs. FileOutputStream fStream = new FileOutputStream("c:\\temp\\file.doc");
oWW = new WordTemplate();
oWW.open(application.getRealPath("WordWriterTemplates/Template1.xls"));
oWW.setDataSource(arrValue, arrName);
oWW.process();
oWW.save(fStream);
fStream.close();
public void save(javax.servlet.http.HttpServletResponse response)
If you pass Save
an HttpServletResponse
object, WordWriter will stream the generated file to the client. If the user
chooses to open (rather than save) the file, it will open in the browser window.
You can call save
more than once for a single instance of
WordTemplate. This allows you to save more than one copy
of a generated file, and/or both save the file and stream it to the browser.
Using multiple process and save
calls,
you can generate multiple files from a single template and an updated data source.
response
HttpServletResponse
instance of this page.
For a servlet or JSP page, this is the variable response
.save
will throw this exception if response
is
null
.save
will throw this exception if a fatal error occurs. oWW = new WordTemplate();
ServletContext ctx = this.getServletContext();
oWW.open(ctx.getRealPath("/WordWriterTemplates/Template1.doc"));
oWW.setDataSource(arrValue, arrName);
oWW.process();
oWW.save(response);
public void save(javax.servlet.http.HttpServletResponse response, java.lang.String attachmentName, boolean openInBrowser)
If you pass save
an HttpServletResponse object, WordWriter will
stream the generated file to the client. This method allows you to specify a
default client-side file name, and whether the file should be opened in the browser
window or in Microsoft Word.
You can call save
more than once for a single instance of
WordTemplate. This allows you to save more than one copy
of a generated file, and/or both save the file and stream it to the browser.
Using multiple process and save
calls,
you can generate multiple files from a single template and an updated data source.
response
HttpServletResponse
instance of this page.
For a servlet or JSP page, this is the variable response
.attachmentName
null
to use the default file name.openInBrowser
openInBrowser
is set to true
, and the
user chooses to open the file, the file will open in the browser
window. If openInBrowser
is set to false
, and the
user chooses to open the file, the file will open in Microsoft Word.
By default, the file will open in the browser window. Note: not all
browsers can embed a Word file in the browser window.save
will throw this exception if response
is
null
.save
will throw this exception if a fatal error occurs. oWW = new WordTemplate();
ServletContext ctx = this.getServletContext();
oWW.open(ctx.getRealPath("/WordWriterTemplates/Template1.doc"));
oWW.setDataSource(arrValue, arrName);
oWW.process();
oWW.save(response, "Output.doc", true);
WordTemplate Class open setLocale setDataSource process save |