Yes, there is. You have to put a DisplayTool in your velocity context.

Check the cell() method in:

http://velocity.apache.org/tools/releases/2.0/javadoc/org/apache/velocity/tools/generic/DisplayTool.html

You would typically write: $disp.cell($jobinfo.localNameOfJobInXml,30)


  Claude


On 01/12/2010 15:56, Johannes Homuth wrote:
Hi everybody

I want to use velocity to create a "let's say" table. Therefore I have a created a simple template.

================================================================================
ENGINE STATE
================================================================================ Jobname | Execution State | Duration --------------------------------------------------------------------------------
#foreach( $jobinfo in $infoList )
$jobinfo.localNameOfJobInXml | $jobinfo.executionState | $jobinfo.executionDuration --------------------------------------------------------------------------------
#end
================================================================================

Everything allright so far, but now I want to align the strings. The inserted values for the variables in the template don't
have the same length. So the generated output looks like this

....
Jobname | Execution State | Duration --------------------------------------------------------------------------------
CheckDclStatusJob | EXECUTED_WITH_ERRORS | 00:00:00
--------------------------------------------------------------------------------
PcImportJob | NOT_EXECUTED_FAILED_DEPENDENCY | --:--:--
--------------------------------------------------------------------------------
OeImportJob | NOT_EXECUTED_FAILED_DEPENDENCY | --:--:--
--------------------------------------------------------------------------------
....

Looks like crap! Thats why I want to align the strings. Is there anything like String.format("%-20s",test) which reserves a number of columns of a String?


Output should be something like this

....
Jobname | Execution State | Duration --------------------------------------------------------------------------------
CheckDclStatusJob      | EXECUTED_WITH_ERRORS              | 00:00:00
--------------------------------------------------------------------------------
PcImportJob            | NOT_EXECUTED_FAILED_DEPENDENCY    | --:--:--
--------------------------------------------------------------------------------
OeImportJob            | NOT_EXECUTED_FAILED_DEPENDENCY    | --:--:--
--------------------------------------------------------------------------------
....


Thx for sugestions



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to