cancel
Showing results for 
Search instead for 
Did you mean: 

When 40 subreports are added programmatically to a report the last subreport to be added is shown first while all other reports are in the correct order

0 Kudos

I am loading multiple sub-reports (up to 40) into a master report document using the Crystal SDK. This is accomplished by obtaining a reference to the detail area, adding a section to it, and then importing the subreport into the detail area. The master report does not contain a whereclause and contains no data other than the other sections so it is display only once.

When I add the section to the master report I give an index of -1 so that it would always appear on the bottom in the report. This works until I print a report containing exactly 40 reports at which time the last section is shown at the top of the report. All other sections (and hence subreports) appear in the correct order. If I print less than 40 reports all sections are in the correct order. If I print more, the export process crashes as documented in

I am using Crystal Reports SDK 13.0.8. Visual Studio 2012. .NET 4.5.2.

The pertinent bit of code is shown below. What might I be doing incorrectly? Is this a Crystal SDK bug?

Thanks,

Ryan


private ReportDocument AddSubReportToParent(string subReportName, string fileName)

{

    try

    {

        CrystalDecisions.ReportAppServer.ReportDefModel.ISCRArea headerArea = _crystalDocument.ReportClientDocument.ReportDefController.ReportDefinition.ReportHeaderArea;

        CrystalDecisions.ReportAppServer.ReportDefModel.ISCRArea detailArea = _crystalDocument.ReportClientDocument.ReportDefController.ReportDefinition.DetailArea;

        CrystalDecisions.ReportAppServer.ReportDefModel.ISCRArea footerArea = _crystalDocument.ReportClientDocument.ReportDefController.ReportDefinition.ReportFooterArea;

        CrystalDecisions.ReportAppServer.ReportDefModel.Section section = new CrystalDecisions.ReportAppServer.ReportDefModel.Section();

        // strip dots from name (any character that is not a number or letter causes a name/ID runtime error from the Crystal Reports SDK)

        string sectionName = "Section" + subReportName.Replace(".", "");

        section.Name = sectionName;

        section.Kind = CrystalDecisions.ReportAppServer.ReportDefModel.CrAreaSectionKindEnum.crAreaSectionKindDetail;

        section.Width = headerArea.Sections[0].Width;

       _crystalDocument.ReportClientDocument.ReportDefController.ReportSectionController.Add(section, detailArea, -1);

        _crystalDocument.ReportClientDocument.SubreportController.ImportSubreport(subReportName, _configSettings.InputPath + "\\" + fileName, section);

        ReportDocument subreport = _crystalDocument.OpenSubreport(subReportName);

        return subreport;

    }

    catch (Exception ex)

    {

        Logger.ErrorException(ex);

        throw;

    }

}

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Hi Ryan

The search string 'crystal net 40' (search box in top right corner, returns this KBA:

2105208 - ER - CR .NET SDK has a Section limit set to 104 and subreport limit of 40

SP 13 for "SAP Crystal Reports, Developer Version for Visual Studio .NET" can be downloaded here:

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow me on Twitter

Answers (0)