日期:2014-05-20 浏览次数:20915 次
protected void Page_Load(object sender, EventArgs e)
{
ReportDocument rd = new ReportDocument();
FieldHeadingObject fho;
rd.Load(Server.MapPath("CrystalReport.rpt"));
//Section2为默认页眉节名称,根据报表设计可能有所不同
Section headerSection = rd.ReportDefinition.Sections["Section2"];
for (int i = 0; i <= headerSection.ReportObjects.Count-1; i++)
{
//控件名称
Response.Write(headerSection.ReportObjects[i].Name +",");
//控件类型
Response.Write(headerSection.ReportObjects[i].Kind.ToString() +",");
//此处只处理字段标题字段,其余类似
if (headerSection.ReportObjects[i].Kind.ToString() == "FieldHeadingObject")
{
fho = (FieldHeadingObject)headerSection.ReportObjects[i];
Response.Write("标题字段内容:" + fho.Text + "<br/>");
}
else
Response.Write("非标题字段X坐标:" + headerSection.ReportObjects[i].Left + "<br/>");
}
}
------解决方案--------------------