DigitalDoor.Reporting.Blazor 1.15.53

dotnet add package DigitalDoor.Reporting.Blazor --version 1.15.53
NuGet\Install-Package DigitalDoor.Reporting.Blazor -Version 1.15.53
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DigitalDoor.Reporting.Blazor" Version="1.15.53" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DigitalDoor.Reporting.Blazor --version 1.15.53
#r "nuget: DigitalDoor.Reporting.Blazor, 1.15.53"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DigitalDoor.Reporting.Blazor as a Cake Addin
#addin nuget:?package=DigitalDoor.Reporting.Blazor&version=1.15.53

// Install DigitalDoor.Reporting.Blazor as a Cake Tool
#tool nuget:?package=DigitalDoor.Reporting.Blazor&version=1.15.53

DigitalDoor.Reporting

Using DigitalDoor Reporting to create ViewModel and use to export in PDF or use in DigitalDoor.Reporting.Blazor to preview in HTML.

How to use:

Install nuget

dotnet add package DigitalDoor.Reporting.Blazor --version 1.15.53

Register the services

    services.AddReportingBlazorServices();

Create a report ViewModel

Create object page setup

    Setup reportSetUp = new(PageSize.A4, Orientation.Portrait);

Setup Header, Body and Footer (header and footer is not required, default all document it's a Body)

    reportSetUp.Header = new Section(new Format(210, 70));
    reportSetUp.Body = new Section()
    {
        Format = new Format()
        {
            Dimension = new Dimension(210, 222),        //full body size
        },
        Row = new Row()             //define size per each element to iterate
        {
            Dimension = new Dimension(89, 18)
        }
    };
    reportSetUp.Footer = new Section(new Format(210, 7.3));

Add columns (elements) to each section

    reportSetUp.Header.AddColumn(new ColumnSetup()
    {
        Format = new(165, 6) { FontDetails = new Font(new Shade(13)), Position = new(3, 7) },
        DataColumn = Item.SetItem<Model>(p => p.Name)
    });
    reportSetUp.Body.AddColumn(new ColumnSetup()
    {
        Format = new(165, 6) { FontDetails = new Font(new Shade(13)), Position = new(3, 7) },
        DataColumn = Item.SetItem<Model>(p => p.Name)
    });
    reportSetUp.Footer.AddColumn(new ColumnSetup()
    {
        Format = new(165, 6) { FontDetails = new Font(new Shade(13)), Position = new(3, 7) },
        DataColumn = Item.SetItem<Model>(p => p.Name)
    });

Add data to the collection. Data will be loop in a foreach to render the report

    List<Model> content = new List<Model>(await Repository.GetModelData());
    List<ColumnData> data = new List<ColumnData>();
    int row = 1;            //define first row in the section
    if(content.Any())
    {
        //header data
        data.Add(new ColumnData() { Section = SectionType.Header, Column = Item.SetItem<Model>(p => p.Name), Value = content.Name, Row = row });
        // more row data then increment row++
        //body data
        row = 1;            //reset row
        foreach(PackByTrolley item in content)
        {
            data.Add(new ColumnData() { Section = SectionType.Body, Column = Item.SetItem<Model>(p => p.Name), Value = content.Name, Row = row });
            row++;
        }
        //footer data
        row = 1;            //reset row
        data.Add(new ColumnData() { Section = SectionType.Footer, Column = Item.SetItem<Model>(p => p.Name), Value = content.Name, Row = row });      
    }

Full class example

    public class CreateReportHandler
    {
        readonly IReportsOutputPort Output;         //from digitalDoor.Reporting.Entities, registered by services.AddReportsServices();
        readonly IGetDataRepository Repository;

        public GetReportHandler(IReportsOutputPort output, IGetDataRepository repository)
        {
            Output = output;
            Repository = repository;
        }

        public async ValueTask Handle()
        {
            Setup reportSetUp = new(PageSize.A4, Orientation.Portrait);
            reportSetUp.Header.AddColumn(new ColumnSetup()
            {
                Format = new(165, 6) { FontDetails = new Font(new Shade(13)), Position = new(3, 7) },
                DataColumn = Item.SetItem<Model>(p => p.Name)
            });
            reportSetUp.Body.AddColumn(new ColumnSetup()
            {
                Format = new(165, 6) { FontDetails = new Font(new Shade(13)), Position = new(3, 7) },
                DataColumn = Item.SetItem<Model>(p => p.Name)
            });
            reportSetUp.Footer.AddColumn(new ColumnSetup()
            {
                Format = new(165, 6) { FontDetails = new Font(new Shade(13)), Position = new(3, 7) },
                DataColumn = Item.SetItem<Model>(p => p.Name)
            });

            List<Model> content = new List<Model>(await Repository.GetModelData());
            List<ColumnData> data = new List<ColumnData>();
            int row = 1;            //define first row in the section
            if(content.Any())
            {
                //header data
                data.Add(new ColumnData() { Section = SectionType.Header, Column = Item.SetItem<Model>(p => p.Name), Value = content.Name, Row = row });
                // more row data then increment row++
                //body data
                row = 1;            //reset row
                foreach(PackByTrolley item in content)
                {
                    data.Add(new ColumnData() { Section = SectionType.Body, Column = Item.SetItem<Model>(p => p.Name), Value = content.Name, Row = row });
                    row++;
                }
                //footer data
                row = 1;            //reset row
                data.Add(new ColumnData() { Section = SectionType.Footer, Column = Item.SetItem<Model>(p => p.Name), Value = content.Name, Row = row });
            }
            else
            {
                reportSetUp = new();
            }
            await Output.Handle(reportSetUp, data);     //create ReportViewModel in a property IReportsOutputPort.Content
        }
    }

Using report component

<ReportView ReportModel=ReportModel ShowPreview=true />
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.15.53 100 3/21/2024
1.14.52 80 3/19/2024
1.14.51 183 12/11/2023
1.14.50 128 11/22/2023
1.13.51 94 11/22/2023
1.13.50 91 11/7/2023
1.13.49 106 11/3/2023
1.13.48 111 10/24/2023
1.13.47 111 10/4/2023
1.13.46 119 9/8/2023
1.13.45 117 9/4/2023
1.13.44 120 8/27/2023
1.12.43 122 8/25/2023
0.11.42 127 5/23/2023
0.11.41 105 5/23/2023
0.11.40 104 5/22/2023
0.9.38 309 11/21/2022
0.8.36 297 11/9/2022
0.8.34 308 11/6/2022
0.8.33 377 9/13/2022
0.8.32 363 9/6/2022
0.8.31 354 9/5/2022
0.7.30 372 8/25/2022
0.7.29 372 8/21/2022
0.7.28 378 8/16/2022
0.7.27 377 7/30/2022
0.7.26 357 7/30/2022
0.7.25 358 7/30/2022
0.7.24 387 7/30/2022
0.7.23 385 7/29/2022
0.7.22 374 7/28/2022
0.7.21 375 7/28/2022

2024-03-21: Add radius property for the borders. Fixed image dimensions. Fixed button report style. Update nuegets.
2024-03-20: Removed double possible button in PrintReportComponent and change default colour button in Bulma CSS in the component PrintReport to is-primary
2023-12-12: Refactor to avoid duplicate code and create new service to manage create pdf. Add Dependency container to add reporting services and new service.
2023-12-11: Update DigitalDoor.Reporting to version 1.14.51.
2023-11-22: Update frameworks target to NET 6 and NET 8. Update DigitalDoor.Reporting to version 1.14.50.
2023-11-07: Update DigitalDoor.Reporting to version 1.13.51.
2023-11-03: Fixed image positions when has rotation.
2023-10-24: Update DigitalDoor.Reporting to version 1.13.49.
2023-10-04: Update DigitalDoor.Reporting to version 1.13.48.
2023-09-08: Update DigitalDoor.Reporting to version 1.13.47.
2023-09-01: Fixed in Blazor Server how to detect a image. Update DigitalDorr.Reporting to version 1.13.46.
2023-08-28: Using IReportAsBytes to generate the pdf direct. Changes in PrintReport component about how events are working. GetHtml return directly a HTML and fire OnGetHTML but also GeneratePDF fire OnGetHTML. Removed Showbutton because now can use directly the IReportAsBytes if don't like show a button.