水晶报表11:如何处理或修剪特殊字符 [英] Crystal reports 11: How to handle or trim special characters

查看:213
本文介绍了水晶报表11:如何处理或修剪特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的水晶报告中,我注意到从表中提取的字段之一有特殊字符。更具体地说,回车和制表符。有没有办法解决这个问题,所以它不会在我的报告中显示为空白。

In my crystal report, I noticed one of the fields being pulled from a table has special characters. More specifically carriage returns and tabs. Is there a way to strip this out, so it doesn't show up blank in my reports?

提前感谢。

推荐答案

这样做:

stringvar output := {TABLE_NAME.FIELD_NAME};
output := Trim(output);  //get rid of leading & trailing spaces
output := Replace(output,Chr(13),'');  //get rid of line feed character
output := Replace(output,Chr(10),'');  //get rid of carriage return character

//add any other special characters you want to strip out.

如果你有很多字符要剥离,你可以使用这种略微夸张的方法。只需在[]中添加要除去的任何字符:

If you have a lot of characters to strip out, you can use this slightly fancier approach. Just add whatever characters you want to strip out to the in[]:

stringvar input := {DROPME.TEST_FIELD};
stringvar output := '';
numbervar i;

input := Trim(input);

for i := 1 to Length(input) Step 1 do
  if not(input[i] in [Chr(13),Chr(10)]) then
    output := output + input[i];

output

这篇关于水晶报表11:如何处理或修剪特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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