如何在水晶报表中以编程方式编辑标签?
我有一个 Crystal Reports 报表,我想通过 C# 以编程方式编辑标签。我可以操作数据源,但无法编辑标签。
我正在设计一份账单报告,因此我需要显示公司详细信息、日期时间和一些我无法从数据源获取的其他信息。
I have a Crystal Reports report and I want to edit a label programmatically from c#. I can manipulate data source but cannot edit a label.
I'm designing a bill report so I need to display company details, date time and some other information which I can't get from my data source.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查看 CR 对象模型。您可以通过编程控制的内容存在限制,但这应该会有所帮助。
Take a look at the CR Object Model. There are limits to what you can control programatically but this should help.
您需要将此给定的
Label
设为FomulaField
,然后可以通过FormulaFieldDefinitions
集合访问该Label
,然后您将使用您感兴趣的 FormulaFieldDefinition
类对象。此外,此类公司信息等应始终直接放在报告本身上,即编辑后的RPT文件上。尤其是在谈论公司徽标时,您需要这样做。
You will need to make this given
Label
aFomulaField
which will then be accessible through theFormulaFieldDefinitions
collection, and you will work with theFormulaFieldDefinition
class object that is of interest for you.Besides, such company information and the like should always be placed directly on the report itself, that is, the edited RPT file. You want to do this particularly when speaking about the company's logo.
通常对于账单,公司名称及其详细信息(如地址等)显示在账单顶部。在这种情况下,我使用的是报告标题。在这种情况下,您可以非常轻松地传递要显示的文本。在运行时传递某些内容的另一种方法是使用报告参数。您可以将参数绑定到字段或公式。参数也很容易传递。
有一次,我使用以下代码动态地从报表中获取参数并将其绑定到网格视图:
并使用以下代码段来设置参数:
Normally for a bill, where the company name and details of it (like address etc) are shown at the top of the bill. In such a case, what I use is the report header. In that case, you can pass on the text to be shown very easily. The other way of passing on something at runtime will be using report parameter. You can bind the parameter to a field or to a formula. Parameters are also very easy to pass on.
In one occasion, I have used the following code to get the parameters from a report dynamically and bind it to a gridview:
And used the following code segment to set parameters: