tags:

views:

4

answers:

2

Hi Folks, Basically there is a form with text field, I have to create provided content by the business in this text field , Once the document is saved then it display in view. Based on the Key value it looks into the content of the of text field then sent to the concerned user in email. At the time of creating content tried to made the text allign by pressing space bar ,Back space and etc etc. But still I found email is delivered without any Allignment which looks weird.

The content is displaying like below.

Label: Date: Description:

Test1   TestDate1            Abcdefghijklmnopqrstuvwxyz
Test2     TestDate2        asdfasf
Test3 TestDate3               asdfasdfasdfasdf

See there is allignment issue in Date and Description . The content should display like below..

Label: Date: Description:

Test1 TestDate1 Abcdefghijklmnopqrstuvwxyz
Test2 TestDate2 asdfasf
Test3 TestDate3 asdfasdfasdfasdf

Any suggestion will be appreciable. Rupesh

A: 

Hi Folks, Under label column all the Label should come with proper allignment , under date column all date should be displayed with proper allignment and under Description all Description should come in proper allignment. Why again I posted is I didn't find my question what I wanted to convey you people, now I guess you people might have got the Idea.

Thanks for any suggestion.. Rupesh

Rupesh
This question related to my previous post..
Rupesh
A: 

You'll need to use a monospace font for your text field (as demonstrated above) and you'll have to tweak your data behind that text field.

Suppose you have three multi-value input fields in a form: txtLabel, txtDate, and txtDescription. You also have one additional field called "display" to display them. The display field could have a formula like this:

txtLabel + " " + txtDate + " " + txtDescription

(Note the display field needs to be set to multi-value, and the font needs to be set to courier new or a monospace font)

That works great if the input fields all have the same lengths. If they don't, you need to force them to have the same lengths. To do that, you can change your code to something like this:

    @For(n :=1; n<=@Elements(txtLabel); n:= n + 1;
FIELD displayTable := displayTable + @Left(txtLabel[n]; 10) + @Repeat(" "; 11 - @Min(10; @Length(txtLabel[n]))) + @Left(txtDate[n]; 10) + @Repeat(" "; 11 - @Min(10; @Length(txtDate[n]))) + @Left(txtDescription[n]; 20) + @NewLine);
displayTable

I'll admit, that is pretty ugly. But let's break it down. We've added three key things:

First, the @For loop. This let's us work on each row individually. It's necessary because the @Length formula needs to act on a single value of our multi-value field.

Second, within the loop we've limited the lengths of the columns using the @Left formula. txtLabel and txtDate can be no more than 10 characters now, and txtDescription is capped at 20 characters.

Third, we've added the appropriate amount of spaces so the next column lines up correctly. The @Repeat(@Min(@Length())) calculations test the length of the fields. The result is the number of spaces we need to add to make 10 characters, plus one space for column padding. For example, if txtLabel is 10 characters, the @Repeat formula will add one more space between txtLabel and txtDate. If txtLabel is 3 characters, the @Repeat formula will add 8 spaces. The result is this:

txtLabel   txtDate    txtDescription
Stack Over 6/1/2009   Programming Question
Superuser  10/1/2009  Computer questions
Server Fau 2/1/2010   IT/Admin questions
Ken Pespisa

related questions