Search results
Suggest a FeaturePDF

Does Bold Reports have the option convert report to C# object models

To convert a report to a C# object model, a ReportSerializer helper is included with Bold Reports. Please find the following steps for obtaining the report in the C# object model using Report Serializer.

    FileStream fileStream = new FileStream( reportFolderPath + "\Resources\sales.rdl", FileMode.Open, FileAccess.Read);

    MemoryStream reportStream = new MemoryStream();
    fileStream.CopyTo(reportStream);
    reportStream.Position = 0;
    fileStream.Close();

    BoldReports.RDL.DOM.ReportSerializer reportSerializer = new BoldReports.RDL.DOM.ReportSerializer();

    // Method to get the reports with ReportDefinition object model
    var reportDefinition = reportSerializer.GetReportDefinition(reportStream);

    // Property to get the parameters information from report.
    var reportParameters = reportDefinition.ReportParameters;

    // Property to get the datasources information from report.
    var reportDatasources = reportDefinition.DataSources;

    // Property to get the datasets from report.
    var dataSets = reportDefinition.DataSets;

    // Property to get the report items information from report body.
    BoldReports.RDL.DOM.ReportItems bodyReportItems = reportDefinition.ReportSections[0].Body.ReportItems;

    // Property to get the report items information from report header.
    var headerReportItems = reportDefinition.ReportSections[0].Page.PageHeader.ReportItems;

    // Property to get the report items information from report footer.
    var footerReportItems = reportDefinition.ReportSections[0].Page.PageFooter.ReportItems;