FastReports / FastReport

Free Open Source Reporting tool for .NET6/.NET Core/.NET Framework that helps your application generate document-like reports

Home Page:https://www.fast-report.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Only one row of data output when exporting to PDF with Version=2023.2.14

grewegreg opened this issue · comments

Describe the bug
When generating a report, and exporting to a PDF, the generated PDF contains only one row of data, when the data contains 470 items. There is no error thrown, my assumption is that I am missing setting a property somewhere.

When viewing the report in the designer, with a JSON data source, all rows are generated. Code sample is listed below. The report template, sample output from the designer, the generated PDF file, actual JSON data, and a screen shot of the console output are attached.

Nuget Package Information

  <ItemGroup>
    <PackageReference Include="FastReport.Data.Json" Version="2023.2.0" />
    <PackageReference Include="FastReport.OpenSource" Version="2023.2.14" />
    <PackageReference Include="FastReport.OpenSource.Export.PdfSimple" Version="2023.2.14" />
    <PackageReference Include="FastReport.OpenSource.Web" Version="2023.2.14" />
  </ItemGroup>

To Reproduce
Steps to reproduce the behavior:

 public void TestReport(string reportName, Dictionary<string, object> parameters, IEnumerable<TBaseItem> reportData, string connectionName)
    {
        string reportPath = Path.Combine(Directory.GetCurrentDirectory(), ApplicationConstant.Reports.FILES_FOLDER);
        string reportPathFile = Path.Combine(reportPath, $"{reportName}.frx");
        Report report = new Report();
        report. Load(reportPathFile);
        foreach (KeyValuePair<string, object> parameter in parameters)
            report.SetParameterValue(parameter. Key, parameter. Value);


  <!-- Added the lines below while testing.  Same result without these lines -->
        report.Report.Dictionary.DataSources.Clear();
        report.Report.Dictionary.ClearRegisteredData();
        report.Report.Dictionary.RegisterBusinessObject(reportData, connectionName, reportData.Count(), true);
  <!-- Added the lines above while testing.  Same result without these lines -->

        report.RegisterData(reportData, connectionName, reportData.Count());
        Console.WriteLine($"connectionName = {connectionName}");
        Console.WriteLine($"reportData.Count() = {reportData.Count()}");
        report. Prepare();
        using MemoryStream ms = new();
        PDFSimpleExport pdfExport = new();
        pdfExport.Export(BaseReport.Report, ms);
        ms.Flush();
        ms.Position = 0;
        string tempFilePath = GetRandomFileName();
        Console.WriteLine($"tempFilePath = [{tempFilePath}]");
        using (var fs = new FileStream(tempFilePath, FileMode.Create, FileAccess.Write))
        {
            ms.WriteTo(fs);
        }
       report. Dispose();
}

Expected behavior
I would expect the generated PDF to contain all the data rows for each of the items contained within the reportData (IEnumerable) variable.

Stacktrace
No Exception data

Screenshots/Attachments
Generated PDF report:
kswynk21.pdf

Console output, showing data row count:
Screenshot 2023-05-22 104553

Report template:
ContributionSummary.txt

Sample output from designer:
Designer-Screenshot 2023-05-22 104913

Sample JSON Data:
Contributions_json.txt

Device:

  • Windows 11 Pro 22H2
  • Browser Microsoft Edge
  • Version 113.0.1774.50 (Official build) (64-bit)

Additional context
The code sample is from using the base Report, not the WebReport. The WebReport exhibits the same behavior, with the same code.

commented

Hello, you should bind DataBand to DataSource

((DataBand)report.Report.FindObject("Data1")).DataSource = report.GetDataSource(connectionName);

Try to place this string before report.Prepare();

Result

image