Click here to Skip to main content
13,558,141 members
Rate this:
Please Sign up or sign in to vote.
See more:
private int SubreportTotelPage(CrystalReportViewer CrvViewer)
   int TotalPage = 0;
   ReportDocument reportDocument = ((ReportDocument)CrvViewer.ReportSource);
  Sections sections = reportDocument.ReportDefinition.Sections;
  foreach (Section section in sections)
        ReportObjects reportObjects = section.ReportObjects;
            foreach (ReportObject reportObject in reportObjects)
               if (reportObject.Kind == ReportObjectKind.SubreportObject)
                   SubreportObject subreportObject = (SubreportObject)reportObject;
                            if (subreportObject.SubreportName == "Sub_Memorandum.rpt")
 CrystalDecisions.CrystalReports.Engine.TextObject rptTxtGroup = subReportDocument.ReportDefinition.ReportObjects["Text9"] as CrystalDecisions.CrystalReports.Engine.TextObject;
                                if (rptTxtGroup != null)
                                    return TotalPage = Convert.ToInt16

                         /*       CrystalDecisions.CrystalReports.Engine.FieldObject rptFieldGroup = (subReportDocument.ReportDefinition.ReportObjects["{@NoofPageinSubReport}"] as CrystalDecisions.CrystalReports.Engine.FieldObject);
                                if (rptFieldGroup != null)
                                    return TotalPage = Convert.ToInt16(rptFieldGroup.ToString()); */
                                    return TotalPage;

In Report preview report Function NoofPageinSubReport show correct value ie 6
but the C# function return text "@NoofPageinSubReport"

when i am using CrystalDecisions.CrystalReports.Engine.FieldObject
it return "@NoofPageinSubReport" text ... ie
Shared numberVar TotalPageSubreport;
TotalPageSubreport:=PageNumber as out put.
Posted 17-Jan-13 2:11am
Updated 17-Jan-13 7:02am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01-2016 | 2.8.180515.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100