在Crystal Reports中设置子报表文本对象

时间:2014-04-22 08:58:10

标签: c# crystal-reports subreport

我想通过资源文件设置子报表标题文本。这是我在下面尝试过的代码

  ReportDocument rDocument = (ReportDocument)Session["ReportSource"];

 ((TextObject)rDocument.Subreports["HolidaySubReport"].ReportDefinition.
 ReportObjects["HolidaySchedule"]).Text=Resources.Resources.HolidaySchedule;

但在这里我收到的错误为object reference not set to instance of object

我如何解决这个问题。非常感谢。

1 个答案:

答案 0 :(得分:0)

TextObject txtpentotal = (TextObject)objRpt.Subreports["Subreport.rpt"].ReportDefinition.Sections["Section4"].ReportObjects["txttotal"];
txtpentotal.Text = pen.Text;