crystal-reports - Crystal 报表 11 : How to handle or trim special characters

标签 crystal-reports

在我的 Crystal 报告中,我注意到从表中拉出的字段之一具有特殊字符。更具体地说,回车和制表符。有没有办法去掉它,这样它就不会在我的报告中显示为空白?

提前致谢。

最佳答案

这应该这样做:

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

关于crystal-reports - Crystal 报表 11 : How to handle or trim special characters,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/398260/

相关文章:

crystal-reports - Crystal 报表 - 最后一页为空白

crystal-reports - 如何在 Crystal Reports 中对齐线条

crystal-reports - 有没有办法以编程方式在 Crystal 报告中获取字段名称?

c# - 如何在 rdlc 报告中将日期格式更改为 dd mmm yyyy?

c# - Crystal 报表中的重复行

pdf - 让 Crystal 在 PDF 中正确嵌入 TT 字体

c# - 未知服务器标签 'CR:CrystalReportViewer'

c# - 更改 Crystal Reports 查看器连接字符串 ASP.NET

crystal-reports - 打开报表时 Crystal Reports XI 挂起

c# - 连接数据库中的 Crystal Reports