如何在Crystal Reports中的StringVar中插入换行符 [英] How to insert a line break in a StringVar in Crystal Reports

查看:394
本文介绍了如何在Crystal Reports中的StringVar中插入换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Crystal Reports中的StringVar中输入换行符(或通常用转义字符解析的其他非文本字符)

How do I enter a line break (or other non-text characters usually solved with escape characters) in a StringVar in Crystal Reports?

想要的输出:


第1行

第2行

line 1
line 2

我尝试过 StringVar s:=line 1 \\\
line 2;
,但是不行。

推荐答案

这可能不是一个很大的改进,但你可以建立一个字符串格式,自定义函数:

It may not be much of an improvement, but you could build a string-formatting, custom function:

// sf()
Function (Stringvar text)

    Stringvar Array keys := ["\n"];
    Stringvar Array values := [Chr(10)+Chr(13)];

    Numbervar i;

    For i := 1 to Ubound(keys) do (
        text := Replace(text, keys[i], values[i])
    );

    text;

//{@ text}
sf("line 1 \n line 2")

如果您需要支持其他转义序列,这将为您提供一些可扩展性。

This would offer you some extensibility should you need to support additional escape sequences.

这篇关于如何在Crystal Reports中的StringVar中插入换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆