fillWithData (String, Map, IDocumentDataSource, DataPresentationTemplate, IDocEngineHelper, IDomainVersion, int, Boolean, int)
public ReportResult fillWithData ( String dirPath, Map params, IDocumentDataSource dataSource, DataPresentationTemplate template, IDocEngineHelper helper, IDomainVersion domainVersion, int outputFormat, boolean printResults, int numCopies) throws DocumentException
This method is called by Aware IM at run time when a particular document template is processed. The method is supposed to replace tags used in the document template with the appropriate attribute values. The values must be obtained from the provided data source – see IDocumentDataSource interface. The overall structure of the method must be as follows:
- Find the contents of the tags used in the document template.
- Call
reset
method of the provided data source to position it on the first element. - Create a document (
BinaryResource
) from the original template that will have tags replaced with their value. - Go through all the tags and call the
getExpressionValue
method of the provided data source to calculate the value of the expression used inside the tag - Replace each tag in the document with its calculated value
- Call the next method of the data source. While there are elements in the data source repeat steps 3 to 5.
See also the example.
Parameters
dirPath | the name of the directory where the template file is stored |
params | can be ignored |
dataSource | the source of data for the values of the tags. See the IDocumentDataSource interface. |
template | the document template which is being filled with data |
helper | can be ignored |
domainVersion | the business space version where the document template is defined |
outputFormat | can be ignored |
printResults | if true the resulting document(s) should also be sent to the printer |
numCopies | number of copies to print (only if printResults is true) |
Returns
A structure represented by the ReportResult
object. The first document created at the step 3 must be set into this structure as the BinaryResource
. All other documents must be stored on disk as files. Full path names of the files must be set into the ReportResult
structure.
Throws
the DocumentException
if error occurs.