T - the class of the context object used to resolve expressions against.public class DocxStamper<T>
extends java.lang.Object
Main class of the docx-stamper library. This class can be used to "stamp" .docx templates to create a .docx document filled with custom data at runtime.
| Constructor and Description |
|---|
DocxStamper() |
DocxStamper(DocxStamperConfiguration config) |
| Modifier and Type | Method and Description |
|---|---|
void |
stamp(java.io.InputStream template,
T contextRoot,
java.io.OutputStream out)
Reads in a .docx template and "stamps" it into the given OutputStream, using the specified context object to
fill out any expressions it finds.
|
void |
stamp(org.docx4j.openpackaging.packages.WordprocessingMLPackage document,
T contextRoot,
java.io.OutputStream out)
Same as stamp(InputStream, T, OutputStream) except that you may pass in a DOCX4J document as a template instead
of an InputStream.
|
public DocxStamper()
public DocxStamper(DocxStamperConfiguration config)
public void stamp(java.io.InputStream template,
T contextRoot,
java.io.OutputStream out)
throws DocxStamperException
Reads in a .docx template and "stamps" it into the given OutputStream, using the specified context object to fill out any expressions it finds.
In the .docx template you have the following options to influence the "stamping" process:
Within comments, you can put expressions in which you can use the following methods by default:
If you need a wider vocabulary of methods available in the comments, you can create your own ICommentProcessor and register it via getCommentProcessorRegistry().addCommentProcessor().
template - the .docx template.contextRoot - the context root object against which all expressions found in the template are evaluated.out - the output stream in which to write the resulting .docx document.DocxStamperException - in case of an error.public void stamp(org.docx4j.openpackaging.packages.WordprocessingMLPackage document,
T contextRoot,
java.io.OutputStream out)
throws DocxStamperException
document - the .docx template.contextRoot - the context root object against which all expressions found in the template are evaluated.out - the output stream in which to write the resulting .docx document.DocxStamperException - in case of an error.Copyright © 2017. All rights reserved.