public interface IXDocReport
extends java.io.Serializable
ITemplateEngine.
To generate reporting, here steps to follow :
IXDocReport switch the type of the document:
IXDocReport report = new fr.opensagres.xdocreport.document.docx.DocXReport();IXDocReport report = new fr.opensagres.xdocreport.document.odt.ODTReport();setTemplateEngine(ITemplateEngine) to set the
template engine (Velocity, Freemarker..) to use :
report.setTemplateEngine(net.sourceforge.rtf.template.freemarker.FreemarkerTemplateEngine.DEFAULT);report.setTemplateEngine(net.sourceforge.rtf.template.velocity.VelocityTemplateEngine.DEFAULT);load(InputStream).createContext() and put your Java model with
IContext.put(String, Object). For instance :
IContext context = report.createContext();
context.put("name", "word");
process(IContext, OutputStream). For instance :
report.process(context, new FileOutputStream(new File("myfile.odt")));
| Modifier and Type | Method and Description |
|---|---|
void |
addPreprocessor(java.lang.String entryName,
IXDocPreprocessor preprocessor)
Register a processor for the entry name.
|
void |
clearData(java.lang.String key)
Clear data.
|
void |
convert(IContext context,
Options options,
java.io.OutputStream out)
Generate report and Convert it to another format (PDF, XHTML, etc).
|
void |
convert(java.util.Map<java.lang.String,java.lang.Object> contextMap,
Options options,
java.io.OutputStream out)
Generate report and Convert it to another format (PDF, XHTML, etc).
|
IContext |
createContext()
Create a new instance of
IContext to put the Java model. |
IContext |
createContext(java.util.Map<java.lang.String,java.lang.Object> contextMap)
Create a new instance of
IContext to put the Java model. |
FieldsMetadata |
createFieldsMetadata()
Create fields metadata.
|
void |
dump(IContext context,
DumperOptions options,
java.io.OutputStream out)
Dump
|
void |
dump(IContext context,
java.io.InputStream document,
DumperOptions options,
java.io.OutputStream out)
Dump
|
void |
extractFields(FieldsExtractor extractor)
Extract declared fields which use syntax of the template egine of the report.
|
void |
extractFields(FieldsExtractor extractor,
ITemplateEngine templateEngine)
Extract declared fields which use syntax of the given template egine of the report.
|
IConverter |
getConverter(Options options)
Returns converter for the report and options.
|
<T> T |
getData(java.lang.String key)
Returns custom data.
|
IDumper |
getDumper(DumperOptions options)
Returns the dumper for the given options.
|
FieldsMetadata |
getFieldsMetadata()
Returns fields metadata used to manage lazy loop for table row.
|
java.lang.String |
getId()
Returns the id of the
IXDocReport. |
java.lang.String |
getKind()
Returns the kind of the report (ODT, docx...).
|
long |
getLastModified()
Returns the last modified time when the report is loaded.
|
MimeMapping |
getMimeMapping()
Returns mime mapping switch the kind of the report (odt, docx...).
|
XDocArchive |
getOriginalDocumentArchive()
Returns the original zipped XML document (odt, docx...) and null if :
no load was done.
|
XDocArchive |
getPreprocessedDocumentArchive()
Returns the preprocessed zipped XML document (odt, docx...) and null if no load was done.
|
ITemplateEngine |
getTemplateEngine()
Returns the template engine (Velocity, Freemarker..) to use switch the syntax used in the XML document.
|
boolean |
isPreprocessed()
Returns true if report was processed and false otherwise.
|
void |
load(java.io.InputStream sourceStream)
Load XML document (odt, docx...) from input stream.
|
void |
preprocess()
Force the preprocessing step.
|
void |
process(IContext context,
java.io.OutputStream out)
Merge the docx, odt document with Java model from the context and register the result to the output stream.
|
void |
process(IContext context,
java.lang.String entryName,
java.io.OutputStream outputStream)
Merge the docx, odt document with Java model from the context and register the entryName transformed to the
output stream.
|
void |
process(java.util.Map<java.lang.String,java.lang.Object> contextMap,
java.io.OutputStream out)
Merge the docx, odt document with Java model from the context Map and register the result to the output stream.
|
void |
process(java.util.Map<java.lang.String,java.lang.Object> contextMap,
java.lang.String entryName,
java.io.OutputStream outputStream)
Merge the docx, odt document with Java model from the context Map and register the entryName transformed to the
output stream.
|
void |
removeAllPreprocessors()
Clear processor.
|
void |
removePreprocessor(java.lang.String entryName)
Remove processor for the entry name.
|
void |
save(ProcessState processState,
java.io.OutputStream out)
Save original|preprocessed XML document archive in the given output stream.
|
void |
saveEntry(java.lang.String entryName,
ProcessState processState,
java.io.OutputStream out)
Save original|preprocessed entryName from XML document archive in the given output stream.
|
void |
setCacheOriginalDocument(boolean cacheOriginalDocument)
Set cache or not for original document archive.
|
void |
setData(java.lang.String key,
java.lang.Object value)
Store custom data.
|
void |
setDocumentArchive(XDocArchive documentArchive)
Returns the zipped XML document (odt, docx...).
|
void |
setFieldsMetadata(FieldsMetadata metadata)
Set fields metadat used to manage lazy loop in table row.
|
void |
setId(java.lang.String id)
Set the id of the
IXDocReport. |
void |
setTemplateEngine(ITemplateEngine templateEngine)
Set the template engine (Velocity, Freemarker..) to use switch the syntax used in the XML document.
|
java.lang.String getKind()
java.lang.String getId()
IXDocReport. This id is used to cache an instance of IXDocReport with
{@link XDocReportRegistry#loadReport(InputStream) and get instance from cache withIXDocReportvoid setId(java.lang.String id)
IXDocReport. This id is used to cache an instance of IXDocReport with
{@link XDocReportRegistry#loadReport(InputStream) and get instance from cache withid - of the IXDocReportvoid load(java.io.InputStream sourceStream)
throws java.io.IOException,
XDocReportException
sourceStream - stream of the XML Document zip (odt, docx...).java.io.IOException - when XML Document zip (odt, docx...) cannot be read.XDocReportException - when preprocessing with IXDocPreprocessor cannot be done.void save(ProcessState processState, java.io.OutputStream out) throws java.io.IOException, XDocReportException
out - java.io.IOExceptionXDocReportExceptionvoid saveEntry(java.lang.String entryName,
ProcessState processState,
java.io.OutputStream out)
throws java.io.IOException,
XDocReportException
out - java.io.IOExceptionXDocReportExceptionvoid setDocumentArchive(XDocArchive documentArchive) throws java.io.IOException, XDocReportException
documentArchive - XDocArchive.XDocReportException - when preprocessing with IXDocPreprocessor cannot be done.java.io.IOExceptionXDocArchive getOriginalDocumentArchive()
setCacheOriginalDocument(boolean).XDocArchive getPreprocessedDocumentArchive()
void setTemplateEngine(ITemplateEngine templateEngine)
templateEngine - ITemplateEngine getTemplateEngine()
void setFieldsMetadata(FieldsMetadata metadata)
metadata - IContext createContext() throws XDocReportException
IContext to put the Java model.XDocReportExceptionIContext createContext(java.util.Map<java.lang.String,java.lang.Object> contextMap) throws XDocReportException
IContext to put the Java model.XDocReportExceptionvoid process(IContext context, java.io.OutputStream out) throws XDocReportException, java.io.IOException
context - of the Java model.out - output stream where merge must be saved.XDocReportExceptionjava.io.IOExceptionvoid process(java.util.Map<java.lang.String,java.lang.Object> contextMap,
java.io.OutputStream out)
throws XDocReportException,
java.io.IOException
context - of the Java model.out - output stream where merge must be saved.XDocReportExceptionjava.io.IOExceptionvoid process(IContext context, java.lang.String entryName, java.io.OutputStream outputStream) throws XDocReportException, java.io.IOException
context - of the Java model.entryName - entry nameout - output stream where merge must be saved.XDocReportExceptionjava.io.IOExceptionvoid process(java.util.Map<java.lang.String,java.lang.Object> contextMap,
java.lang.String entryName,
java.io.OutputStream outputStream)
throws XDocReportException,
java.io.IOException
context - of the Java model.entryName - entry nameout - output stream where merge must be saved.XDocReportExceptionjava.io.IOExceptionIConverter getConverter(Options options) throws XDocConverterException
options - XDocConverterExceptionvoid convert(IContext context, Options options, java.io.OutputStream out) throws XDocReportException, XDocConverterException, java.io.IOException
context - options - out - XDocReportExceptionXDocConverterExceptionjava.io.IOExceptionvoid convert(java.util.Map<java.lang.String,java.lang.Object> contextMap,
Options options,
java.io.OutputStream out)
throws XDocReportException,
XDocConverterException,
java.io.IOException
contextMap - options - out - XDocReportExceptionXDocConverterExceptionjava.io.IOExceptionMimeMapping getMimeMapping()
void setData(java.lang.String key,
java.lang.Object value)
key - value - void clearData(java.lang.String key)
string - <T> T getData(java.lang.String key)
key - void extractFields(FieldsExtractor extractor, ITemplateEngine templateEngine) throws XDocReportException, java.io.IOException
extractor - the fields extractor.templateEngine - the template engine.XDocReportExceptionjava.io.IOExceptionvoid extractFields(FieldsExtractor extractor) throws XDocReportException, java.io.IOException
extractor - the fields extractor.XDocReportExceptionjava.io.IOExceptionvoid setCacheOriginalDocument(boolean cacheOriginalDocument)
cache - boolean isPreprocessed()
long getLastModified()
FieldsMetadata getFieldsMetadata()
FieldsMetadata createFieldsMetadata()
void addPreprocessor(java.lang.String entryName,
IXDocPreprocessor preprocessor)
entryName - preprocessor - void removePreprocessor(java.lang.String entryName)
entryName - void removeAllPreprocessors()
void preprocess()
throws XDocReportException,
java.io.IOException
XDocReportExceptionjava.io.IOExceptionIDumper getDumper(DumperOptions options) throws XDocReportException
options - XDocReportExceptionvoid dump(IContext context, java.io.InputStream document, DumperOptions options, java.io.OutputStream out) throws java.io.IOException, XDocReportException
context - kind - options - java.io.IOExceptionXDocReportExceptionvoid dump(IContext context, DumperOptions options, java.io.OutputStream out) throws java.io.IOException, XDocReportException
context - kind - options - java.io.IOExceptionXDocReportExceptionCopyright © 2022. All Rights Reserved.