为什么在编辑变量时,Delphi中的Fast Report VCL引发堆栈溢出异常? [英] Why is Fast Report VCL in Delphi raising a stack overflow exception when editing a variable?
问题描述
我正在使用Delphi 5和Fast Report 4制作报表应用程序。我在设计时在MyReport.f3中定义了一个变量 ReportTitle,并在运行时为其分配了一个值。为什么我的代码会引发EStackOverflow异常?
I am using Delphi 5 and Fast Report 4 to make a report application. I have defined a variable "ReportTitle" in MyReport.f3 at design time and I assigned a value for it at runtime. Why is my code raising an EStackOverflow Exception?
这是代码示例
frxrprt1.LoadFromFile('c:\MyReport.fr3');
frxrprt1.Variables['ReportTitle'] := 'Sales Summary Report';
frxrprt1.ShowReport;
推荐答案
使用此:
frxrprt1.Variables['ReportTitle'] := '''Sales Summary Report''';
变量值实际上被视为完整的表达式;如果希望它是一个字符串,则需要使用单引号将其作为标准的pascal常数;并且由于您是通过pascal代码执行此操作的,因此需要通过双引号将引号引起来。
The "variable" values are actually treated as full-fledged expressions; If you want it to be a string, it needs to be a standard pascal constant, using single-tick quoting; And since you're doing that from pascal code, you need to quote the quotes by double-quoting.
您可能会出现堆栈溢出,因为快速报告的脚本引擎正在尝试理解您写的内容并遇到递归问题。
You probably get the stack overflow because fast report's scripting engine is trying to make sense of whatever you wrote and runs into a recursive problem.
这篇关于为什么在编辑变量时,Delphi中的Fast Report VCL引发堆栈溢出异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!