Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET CrystalReports
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
(rptTxtGroup.Text.ToString());
 
                         /*       CrystalDecisions.CrystalReports.Engine.FieldObject rptFieldGroup = (subReportDocument.ReportDefinition.ReportObjects["{@NoofPageinSubReport}"] as CrystalDecisions.CrystalReports.Engine.FieldObject);
                                if (rptFieldGroup != null)
                                    return TotalPage = Convert.ToInt16(rptFieldGroup.ToString()); */
                                else
                                    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
WhilePrintingRecords;
Shared numberVar TotalPageSubreport;
TotalPageSubreport:=PageNumber as out put.
Posted 17-Jan-13 3:11am
Edited 17-Jan-13 8:02am
(no name)499K
v2

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 565
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 369
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,466
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,897


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2014
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