Crystal 报表 11:如何处理或修剪特殊字符 [英] Crystal reports 11: How to handle or trim special characters
本文介绍了Crystal 报表 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.
如果您有很多字符要删除,您可以使用这种稍微花哨的方法.只需将要删除的任何字符添加到 in[]:
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
这篇关于Crystal 报表 11:如何处理或修剪特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文