【问题标题】:Set subreport text object in Crystal Reports在 Crystal Reports 中设置子报表文本对象
【发布时间】:2014-06-06 13:17:07
【问题描述】:

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

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

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

但是在这里我得到了object reference not set to instance of object的错误

我该如何解决这个问题。任何帮助将不胜感激。

【问题讨论】:

  • 你在哪一行得到这个错误?
  • 第二行,投射到TextObject
  • 您是否检查过HolidaySubReport 是否存在于rDocument.Subreports 中?
  • 谢谢你是绝对正确的。问题是我给出了对象名称而不是子报告名称

标签: c# crystal-reports subreport


【解决方案1】:
TextObject txtpentotal = (TextObject)objRpt.Subreports["Subreport.rpt"].ReportDefinition.Sections["Section4"].ReportObjects["txttotal"];
txtpentotal.Text = pen.Text;

【讨论】:

  • 请添加一些文字来描述您的修复以及解决问题的方法。仅代码的答案在堆栈溢出时不受欢迎。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多