Crystal Report字段操作 [英] Crystal Report field manipulation

查看:93
本文介绍了Crystal Report字段操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想在Crystal Report中操作一个字段.
像这样:

Hi All,

I want to manipulate a field in Crystal Report.
Like this:

---------------------------
 Details  |  asd  |  ...
---------------------------
@Details  | @asd  |  ...
---------------------------



我想使用我的代码(c#)操纵@Details.
由于我的代码很复杂,我无法通过Crystal Formula Fields进行操作.
有可能吗?

我正在使用Visual Studio2010.
@Details可能会重复,因为它是一个IFieldObject而不是ITextObject.

请帮帮我.

预先感谢.



I want to manipulate the @Details using my code(c#).
I can''t do it by the Crystal Formula Fields because my code is complex.
Is it possible?

I''m using a Visual Studio 2010.
The @Details may repeat because it is an IFieldObject not an ITextObject.

Please help me.

Thanks in advance.

推荐答案


您只需使用c#代码即可完成此操作:
假设您的报告名称为"report",并在其中放置了一个名称为"asd"的字段,并使用c#将值传递给该字段,您可以使用以下行来完成此操作:

Hi,
You can do it simply with c# code:
Let''s say your report name is "report" and you put a field in it with the name "asd" and using c# you want to pass a value to this field you can do it with the line:

report.DataDefinition.FormulaFields["asd"].Text = "\"" + Value + "\"";



请注意("\""+ ... +" \")很重要.



be careful the ("\"" + ... + "\"") is important.


感谢 firas_hamzeh .
它有效,这是我的代码:

Thanks firas_hamzeh.
It works, here''s my code:

DataSet dsAtt = _viewProc.printAttatchment(SoaID, AppType);

var drAtts = dsAtt.Tables[0].Select().Select(o => dsAtt.Tables[0].LoadDataRow(new object[] { o[0], o[1], o[2], o[3], o[4], o[5], o[6], o[7] ,o[8], o[9],o[10], o[11], _viewProc.GetProRatedAddition(o[1], o[2], o[3], SoaID), o[13], o[14], o[15], o[16], o[17] }, true));

DataTable dtAtt = drAtts.CopyToDataTable();
dtAtt.TableName = "Attatchment";
DataSet dsAtta = new DataSet("Attatchment");
dsAtta.Tables.Add(dtAtt);
AttatchmentReport2.SetDataSource(dsAtta);
crAttatchment.ReportSource = AttatchmentReport2;


这篇关于Crystal Report字段操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆