【发布时间】:2013-12-04 07:31:04
【问题描述】:
在我的水晶报表中,我注意到从表格中提取的一个字段有特殊字符。更具体地说,回车和制表符。有没有办法把它去掉,所以它不会在我的报告中显示为空白?
提前致谢。
【问题讨论】:
-
仅供参考,如果你想删除标签,Chr 代码是 Chr(9)。
标签: crystal-reports
在我的水晶报表中,我注意到从表格中提取的一个字段有特殊字符。更具体地说,回车和制表符。有没有办法把它去掉,所以它不会在我的报告中显示为空白?
提前致谢。
【问题讨论】:
标签: crystal-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[]:
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
【讨论】: