关于水晶报表打包的一些注意的地方![8]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

    // if you wish to change the schema name as well, you will need to set Location property as follows:
    // crTable.Location = "<new schema name>." + crTable.Name;
   }

   //Set the ReportSource of the CrystalReportViewer to the strongly typed Report included in the project
   crystalReportViewer1.ReportSource = crReportDocument;

还有一点要注意:
如果你用到了子报表,一定要处理:

//Go through each sections in the main report and identify the subreport by name
   crSections = crReportDocument.ReportDefinition.Sections;

   foreach(Section crSection in crSections)
   {
    crReportObjects = crSection.ReportObjects;
    //loop through all the report objects to find all the subreports
    foreach(ReportObject crReportObject in crReportObjects)
    {
     if (crReportObject.Kind == ReportObjectKind.SubreportObject)
     {
      //you will need to typecast the reportobject to a subreport
      //object once you find it
      crSubreportObject = (SubreportObject)crReportObject;

      //open the subreport object
      crSubReportDoc = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName);
      //Once the correct subreport has been located pass it the
      //appropriate dataset
      if(crSubReportDoc.Name == "FirstSub")
      {
       //crSubReportDoc.Database.Tables[0].SetDataSource(ds);
       crSubReportDoc.SetDataSource(ds);
      }
     }
    }
   }
   crystalReportViewer1.ReportSource = crReportDocument;

本文关键:关于水晶报表打包的一些注意的地方!
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top