Lotus Notes 中文本字段的对齐方式

发布于 2024-09-27 18:47:41 字数 641 浏览 7 评论 0原文

基本上有一个带有文本字段的表单,我必须在这个文本字段中创建业务提供的内容,保存文档后,它就会显示在视图中。根据键值,它会查看文本字段的内容,然后通过电子邮件发送给相关用户。在创建内容时,尝试通过按空格键、退格键等来使文本对齐。但我仍然发现电子邮件在发送时没有任何对齐方式,这看起来很奇怪。

内容显示如下。

Label: Date: Description:

Test1   TestDate1            Abcdefghijklmnopqrstuvwxyz
Test2     TestDate2        asdfasf
Test3 TestDate3               asdfasdfasdfasdf

请参阅 Date 和 Description 中存在对齐问题。内容应如下所示显示。

Label: Date: Description:

Test1 TestDate1 Abcdefghijklmnopqrstuvwxyz
Test2 TestDate2 asdfasf
Test3 TestDate3 asdfasdfasdfasdf

在标签列下,所有标签都应正确对齐,
在日期列下,所有日期均应以正确对齐方式显示,并且
描述下的所有描述应正确对齐。

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 align by pressing space bar ,Back space and etc etc. But still I found email is delivered without any Alignment which looks weird.

The content is displaying like below.

Label: Date: Description:

Test1   TestDate1            Abcdefghijklmnopqrstuvwxyz
Test2     TestDate2        asdfasf
Test3 TestDate3               asdfasdfasdfasdf

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

Label: Date: Description:

Test1 TestDate1 Abcdefghijklmnopqrstuvwxyz
Test2 TestDate2 asdfasf
Test3 TestDate3 asdfasdfasdfasdf

Under label column all the Label should come with proper alignment,
under date column all date should be displayed with proper alignment and
under Description all Description should come in proper alignment.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

草莓味的萝莉 2024-10-04 18:47:41

您需要为文本字段使用等宽字体(如上所示),并且必须调整该文本字段后面的数据。

假设表单中有三个多值输入字段:txtLabel、txtDate 和 txtDescription。您还有一个名为“显示”的附加字段来显示它们。显示字段可以有这样的公式:(

txtLabel + " " + txtDate + " " + txtDescription

注意显示字段需要设置为多值,并且字体需要设置为 courier new 或等宽字体)

如果输入字段都具有相同的值,那么效果很好长度。如果不这样做,您需要强制它们具有相同的长度。为此,您可以将代码更改为如下所示:

    @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

我承认,这非常难看。但让我们分解一下。我们添加了三个关键内容:

首先,@For 循环。这让我们可以单独处理每一行。这是必要的,因为 @Length 公式需要作用于我们的多值字段的单个值。

其次,在循环中,我们使用 @Left 公式限制了列的长度。 txtLabel 和 txtDate 现在不能超过 10 个字符,txtDescription 的上限为 20 个字符。

第三,我们添加了适当数量的空格,以便下一列正确排列。 @Repeat(@Min(@Length())) 计算测试字段的长度。结果是我们需要添加 10 个字符所需的空格数,再加上一个用于列填充的空格。例如,如果 txtLabel 为 10 个字符,@Repeat 公式将在 txtLabel 和 txtDate 之间再添加一个空格。如果 txtLabel 为 3 个字符,则 @Repeat 公式将添加 8 个空格。结果是这样的:

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文