Ontimize 5.2072EN

com.ontimize.util.templates
Class WordTemplateGenerator

java.lang.Object
  extended bycom.ontimize.util.templates.AbstractTemplateGenerator
      extended bycom.ontimize.util.templates.WordTemplateGenerator
All Implemented Interfaces:
TemplateGenerator

public class WordTemplateGenerator
extends AbstractTemplateGenerator


Field Summary
static boolean deleteBookmarks
          Variable to use when you want to keep the boorkmarks in the document after write the data in the template.
static boolean highlightBookmarksInTemplate
          Variable used to highlight the bookmarks when a new template is created.
protected  boolean showTemplate
           
 
Fields inherited from class com.ontimize.util.templates.AbstractTemplateGenerator
createLabelsInTemplate, dateFormat, numberFormat
 
Constructor Summary
WordTemplateGenerator()
           
 
Method Summary
protected static void addFieldGroupToDataString(java.util.Hashtable group, java.lang.StringBuffer buffer, java.text.DateFormat df, java.lang.String delimiter)
           
protected static java.lang.String createFieldDataString(java.util.Hashtable data, java.lang.String delimiter, java.text.DateFormat df)
           
protected static java.lang.String createFieldsInGroups(java.util.Hashtable data, java.lang.String delimiter, java.lang.String groupDelimiter, java.text.DateFormat df)
          Create an String with the information of the fields to put in the template.
 java.io.File createTemplate(java.util.Hashtable fieldValues, java.util.Hashtable valuesTable, java.util.Hashtable valuesImages)
          The WordTemplateGenerator adds the possibility to put the fields in the template in a specified order.
 java.io.File fillDocument(java.io.InputStream input, java.lang.String nameFile, java.util.Hashtable fieldValues, java.util.Hashtable valuesTable, java.util.Hashtable valuesImages, java.util.Hashtable valuesPivotTable)
           
 java.util.List queryTemplateFields(java.io.File template)
          Creates a list with all data fields included in the template
 java.util.List queryTemplateFields(java.lang.String template)
          Creates a list with all data fields included in the template
 void setScriptFillDocPath(java.lang.String path)
          Sets the file path for the fill document script.
 void setShowTemplate(boolean show)
          Sets the value of the variable show.
 
Methods inherited from class com.ontimize.util.templates.AbstractTemplateGenerator
calculateRecordCount, containsHashtableValue, createFileFieldData, createImageDataFile, createTableDataDefinition, createTableDataDefinition, createTableDataFile, createTableDataFile, exportFieldData, exportFieldData, exportTableData, fillDocument, fillDocument, fillDocument, getKeysOrder, getScreenPoints, parseNumber, savePngImageFile, setCreateLabelsInTemplate, setDateFormat, setNumberFormat, transformFieldData, transformFieldData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

highlightBookmarksInTemplate

public static boolean highlightBookmarksInTemplate
Variable used to highlight the bookmarks when a new template is created. If highlightBookmarksInTemplate is true when filling a template then undo the highlight.


deleteBookmarks

public static boolean deleteBookmarks
Variable to use when you want to keep the boorkmarks in the document after write the data in the template. By default, bookmarks are deleted (deleteBookmarks = true)


showTemplate

protected boolean showTemplate
Constructor Detail

WordTemplateGenerator

public WordTemplateGenerator()
Method Detail

fillDocument

public java.io.File fillDocument(java.io.InputStream input,
                                 java.lang.String nameFile,
                                 java.util.Hashtable fieldValues,
                                 java.util.Hashtable valuesTable,
                                 java.util.Hashtable valuesImages,
                                 java.util.Hashtable valuesPivotTable)
                          throws java.lang.Exception
Throws:
java.lang.Exception

queryTemplateFields

public java.util.List queryTemplateFields(java.io.File template)
                                   throws java.lang.Exception
Description copied from interface: TemplateGenerator
Creates a list with all data fields included in the template

Parameters:
template - Template to query
Returns:
List with all data fields included in the template
Throws:
java.lang.Exception

queryTemplateFields

public java.util.List queryTemplateFields(java.lang.String template)
                                   throws java.lang.Exception
Description copied from interface: TemplateGenerator
Creates a list with all data fields included in the template

Parameters:
template - Template to query
Returns:
List with all data fields included in the template
Throws:
java.lang.Exception

setScriptFillDocPath

public void setScriptFillDocPath(java.lang.String path)
Sets the file path for the fill document script.
Default value is "com/ontimize/util/templates/script/fillDoc.vbs".

Parameters:
path -

setShowTemplate

public void setShowTemplate(boolean show)
Description copied from interface: TemplateGenerator
Sets the value of the variable show. When this variable takes the value "true", the template is shown to the user. Elsewhere, the template will not be shown

Parameters:
show -

createTemplate

public java.io.File createTemplate(java.util.Hashtable fieldValues,
                                   java.util.Hashtable valuesTable,
                                   java.util.Hashtable valuesImages)
The WordTemplateGenerator adds the possibility to put the fields in the template in a specified order.
The parameter fieldValues can be a EntityResult object, and use the EntityResult.setColumnOrder(List) method to specified the order of the fields in the template.

It is possible to create groups with some fields and put a title for the group in the template.
If some value in the fieldValues parameter is a Hashtable (or EntityResult) then the fields in this hashtable will be in a group in the template and the title will be the key of this hashtable in the parameter fieldValues

Parameters:
fieldValues - : This object contains the data fields attributes and labels to show in the template
valuesTable - : The object contains the table information to insert in the template. This map must have the table entity name as key and the value must be other Hashtable with the columns attributes and names to show (column name - column label)

createFieldDataString

protected static java.lang.String createFieldDataString(java.util.Hashtable data,
                                                        java.lang.String delimiter,
                                                        java.text.DateFormat df)

createFieldsInGroups

protected static java.lang.String createFieldsInGroups(java.util.Hashtable data,
                                                       java.lang.String delimiter,
                                                       java.lang.String groupDelimiter,
                                                       java.text.DateFormat df)
Create an String with the information of the fields to put in the template.
The string has the following format: Group1Title groupDelimiter Group1Fields Group2Title groupDelimiter ...
where the group fields have the format: attr1$#label1$#attr2$#label2$#attr3$#label3...
Example: Group3%#identification$#DNI/CIF$#country$#Country%#Group7%#place$#Place$#subject$#Subject

Parameters:
data -
delimiter -
groupDelimiter -
df -
Returns:

addFieldGroupToDataString

protected static void addFieldGroupToDataString(java.util.Hashtable group,
                                                java.lang.StringBuffer buffer,
                                                java.text.DateFormat df,
                                                java.lang.String delimiter)

Ontimize