Skip to Content
avatar image
Former Member

Cryatal Reports for Visual Studio change on second sureport not saved

Hi, I have a program che cycle on all subrerports of a reports and make some changes on a fields. After I save the report but only changes on first subrport are saved. The program is like follow code. The function : CheckFieldMapping remove some fields with report.ReportDefController.ReportObjectController.Remove(rptObject).

report = New CrystalDecisions.CrystalReports.Engine.ReportDocument

report.Load(strFile, CrystalDecisions.Shared.OpenReportMethod.OpenReportByDefault)

Dim rdc As ISCDReportClientDocument

rdc = report.ReportClientDocument

For Each subReportName As String In subReportNames

Dim subrptObj As SubreportClientDocument

subrptObj = dc.SubreportController.GetSubreport(subReportName)

CheckFieldMapping(rdc.DisplayName, CType(subrptObj, ISCRSubreportClientDocument)) subrptObj = Nothing




report.SaveAs(strFile, False) rdc.Close() rdc = Nothing

Same idea ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Mar 16, 2017 at 05:43 PM

    Hi Filippo,

    Try saving the report after each subreport change and then compare output in CR Designer.

    Or open the subreport rather than just loading it into memory...

    Something like this:

    foreach (CrystalDecisions.CrystalReports.Engine.Section section in rpt.ReportDefinition.Sections)
    foreach (CrystalDecisions.CrystalReports.Engine.ReportObject reportObject in section.ReportObjects)
    if (reportObject.Kind == ReportObjectKind.SubreportObject)
    CrystalDecisions.CrystalReports.Engine.SubreportObject subReport = (CrystalDecisions.CrystalReports.Engine.SubreportObject)reportObject;

    CrystalDecisions.CrystalReports.Engine.ReportDocument subDocument = subReport.OpenSubreport(subReport.SubreportName);

    .... your code



    Add comment
    10|10000 characters needed characters exceeded