Package com.jamasoftware.velocity
Class VelocityReportUtil
- java.lang.Object
-
- com.jamasoftware.velocity.VelocityReportUtil
-
public class VelocityReportUtil extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description VelocityReportUtil(FieldDataTypeManager fieldDataTypeManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
cleanText(java.lang.String html)
This method will go through the provided text cleaning out unnecessary syntax.java.lang.String
encodeTextForHTML(java.lang.String str)
This method will search through the provided text looking for html/xml tags and replacing them with the ascii equivalent.java.lang.String
fromHtmlToRawText(java.lang.String orig)
java.lang.String
getBackGroundColor(ContourItem doc, DocumentTypeFieldDTO fieldDTO, DateFormatter dateFormat)
java.lang.String
getBackGroundColor(ContourItem doc, java.lang.String fieldName, DateFormatter dateFormat)
java.lang.Object
getLookupIdForLookupMatrix(ContourItem document, java.lang.String fieldName)
Used in velocity custom template to get lookup id for a Lookup Matrix Calculated.java.lang.String
getValueForField(ContourItem doc, DocumentTypeDTO documentType, java.lang.String fieldName, DateFormatter dateFormat)
Gets string value for the given field.java.lang.String
getValueForField(ContourItem doc, DocumentTypeDTO documentType, java.lang.String fieldName, DateFormatter dateFormat, boolean exportToExcel)
Gets string value for the given field.java.lang.String
getValueForField(ContourItem doc, DocumentTypeFieldDTO fieldDTO, DateFormatter dateFormat)
Gets string value for the given field.java.lang.String
getValueForField(ContourItem doc, DocumentTypeFieldDTO fieldDTO, DateFormatter dateFormat, boolean exportToExcel)
Gets string value for the given field.java.lang.String
getValueForField(ContourItem doc, java.lang.String fieldName, DateFormatter dateFormat)
java.lang.String
replaceBreakForExcel(java.lang.String str)
This will search through the provided text looking for HTML breaks and Word style breaks and replace them with a simple line break so that the output to Excel.boolean
shouldShowField(DocumentTypeFieldDTO fieldDTO)
java.lang.String
wordBreak(java.lang.String text, int maxLength)
Workaround for Aspose PDF bug.
-
-
-
Constructor Detail
-
VelocityReportUtil
public VelocityReportUtil(FieldDataTypeManager fieldDataTypeManager)
-
-
Method Detail
-
getValueForField
public java.lang.String getValueForField(ContourItem doc, DocumentTypeDTO documentType, java.lang.String fieldName, DateFormatter dateFormat)
Gets string value for the given field.- Parameters:
doc
- documentdocumentType
- document type for the documentfieldName
- name of the field (not the label)dateFormat
- date formatter- Returns:
- string value
-
getValueForField
public java.lang.String getValueForField(ContourItem doc, DocumentTypeDTO documentType, java.lang.String fieldName, DateFormatter dateFormat, boolean exportToExcel)
Gets string value for the given field.- Parameters:
doc
- documentdocumentType
- document type for the documentfieldName
- name of the field (not the label)dateFormat
- date formatterexportToExcel
- whether to export to Excel or not. If export to Excel, the HTML tags will be escaped.- Returns:
- string value
-
shouldShowField
public boolean shouldShowField(DocumentTypeFieldDTO fieldDTO)
-
getBackGroundColor
public java.lang.String getBackGroundColor(ContourItem doc, DocumentTypeFieldDTO fieldDTO, DateFormatter dateFormat)
-
getBackGroundColor
public java.lang.String getBackGroundColor(ContourItem doc, java.lang.String fieldName, DateFormatter dateFormat)
-
getValueForField
public java.lang.String getValueForField(ContourItem doc, DocumentTypeFieldDTO fieldDTO, DateFormatter dateFormat)
Gets string value for the given field.- Parameters:
doc
- documentfieldDTO
- field definitiondateFormat
- date formatter- Returns:
- string value
-
getValueForField
public java.lang.String getValueForField(ContourItem doc, DocumentTypeFieldDTO fieldDTO, DateFormatter dateFormat, boolean exportToExcel)
Gets string value for the given field.- Parameters:
doc
- documentfieldDTO
- field definitiondateFormat
- date formatterexportToExcel
- whether to export to Excel or not. If export to Excel, the HTML tags will be escaped.- Returns:
- string value
-
getValueForField
public java.lang.String getValueForField(ContourItem doc, java.lang.String fieldName, DateFormatter dateFormat)
-
getLookupIdForLookupMatrix
public java.lang.Object getLookupIdForLookupMatrix(ContourItem document, java.lang.String fieldName)
Used in velocity custom template to get lookup id for a Lookup Matrix Calculated.
-
replaceBreakForExcel
public java.lang.String replaceBreakForExcel(java.lang.String str)
This will search through the provided text looking for HTML breaks and Word style breaks and replace them with a simple line break so that the output to Excel.
For example if you would like to display a rich text field in Excel the HTML breaks are treated as new cells. This method will convert the breaks so the text displays correctly in a single Excell cell.- Parameters:
str
- that needs to have breaks replaced for Excel- Returns:
- str with HTML breaks replaced with line breaks
-
encodeTextForHTML
public java.lang.String encodeTextForHTML(java.lang.String str)
This method will search through the provided text looking for html/xml tags and replacing them with the ascii equivalent. Line breaks will also be converted to true HTML breaks.
For example if you use a regular text box on the form within Contour the line breaks will be ignored when displayed in Word. Using the method will ensure those breaks show up. This method will also ensure that if you have entered explicit xml/html tags they will be converted to show up as they were entered.- Parameters:
str
- to be encoded for HTML- Returns:
- str encoded for HTML
-
cleanText
public java.lang.String cleanText(java.lang.String html)
This method will go through the provided text cleaning out unnecessary syntax.
For example this is a useful if the text has been copied from Word which will result in a lot of extra data which can cause odd behavior in reports.- Parameters:
html
- text that needs to be cleaned- Returns:
- html cleaned of unnecessary syntax
-
fromHtmlToRawText
public java.lang.String fromHtmlToRawText(java.lang.String orig)
-
wordBreak
public java.lang.String wordBreak(java.lang.String text, int maxLength)
Workaround for Aspose PDF bug. Long strings without natural word breaks (spaces, dashes, new lines, etc) overrun the boundaries of table cells because Aspose fails to wrap them. This method looks for long sections of continuous text and adds newline characters so Aspose will wrap them- Parameters:
text
- Some text that may need to be broken uptext
- The maximum text block length to allow- Returns:
- The text with linebreaks added to any block of text longer than maxLength
-
-