On Feb 5, 2008 12:19 AM, Omer Uretzky <[EMAIL PROTECTED]> wrote:
> Hi,
>
>
>
> I have few Questions regarding the Template language and I would appreciate
> your help.
>
>
>
> *Alignment problem*:
>
>
>
> I'm having lines aligned in the template like:
>
>
>
> *2. t_${aaa}_k_t               *i_${aaa}_k                - input*
>
> *3. t_${bbb}_t                   *o_${bbb}_r               - output*
>
>
>
> The output doesn't stay aligned and is dependant of the input length:
>
>
>
> *2. t_XXXXXXX_k_t               *i_XXXXXXX_k                - input*
>
> *3. t_YYY_t                   *o_YYY_r               - output*
>
>
>
> Is there a way to solve this issue?

You have to pad and/or truncate the outputs.  The DisplayTool (part of
VelocityTools 2.0) has a set of cell() methods to do this:

http://velocity.apache.org/tools/devel/javadoc/org/apache/velocity/tools/generic/DisplayTool.html#cell(java.lang.Object)

so you would put a DisplayTool instance in the context (you can
configure the default cell length first) and use it like

$display.cell($whatever)

for all your outputs to ensure they stay aligned.  if the DisplayTool
doesn't work perfectly for you, then you can always create your own
tool to do something similar.

>
>
> *Alignment problem no. 2:*
>
> * *
>
> The new line problem:
>
>
>
> I'm getting as an input a String which has a new line in the middle of it
> like:
>
>
>
> *Select * from user*
>
> *Where user_name='aaa'*
>
>
>
> In the template I have something like:
>
>
>
> *The SQL is ${SQL}*
>
>
>
> At a result I'm getting:
>
>
>
> *The SQL is Select * from user*
>
> *Where user_name='aaa'*
>
>
>
> And I would like it to be:
>
>
>
> *The SQL is Select * from user*
>
> *     Where user_name='aaa'*
>
>
>
> How do I achieve this result?
>
>
>
> *Convert line delimeters to Unix*:
>
>
>
> Is there a way to make the output file have line delimiters of Unix and not
> of Windows.

I'm pretty sure Velocity doesn't do any line ending translation.  You
will need to convert those yourself.

> thanks a lot, Omer.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to