DigitalDoor.Reporting 1.13.52

There is a newer version of this package available.
See the version list below for details.
dotnet add package DigitalDoor.Reporting --version 1.13.52
NuGet\Install-Package DigitalDoor.Reporting -Version 1.13.52
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" Version="1.13.52" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DigitalDoor.Reporting --version 1.13.52
#r "nuget: DigitalDoor.Reporting, 1.13.52"
#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 as a Cake Addin
#addin nuget:?package=DigitalDoor.Reporting&version=1.13.52

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

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 --version 1.13.52

Register the services csharp services.AddReportsServices();

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) csharp 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 csharp 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 csharp 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 ` csharp 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
    }
}

`

Create a PDF

To create a PDF need to manage the report ViewModel using a Handler and then use with the abtractions csharp byte[] pdf = await IReportAsBytes.GenerateReport(reportModel); IReportAsBytes it's registered by services.AddReportsServices();

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 was computed.  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 (2)

Showing the top 2 NuGet packages that depend on DigitalDoor.Reporting:

Package Downloads
DigitalDoor.Reporting.Blazor

Provide a components to render,print and preview the reports Generated by DigitalDoor.Reporting with Blazor Components. Also can generate reports from code using clean architecture.

DigitalDoor.Reporting.Extensions

Extension to simplify the Presenter Injection when use Digital Reporting.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.15.53 115 3/21/2024
1.14.52 100 3/19/2024
1.14.51 228 12/11/2023
1.14.50 148 11/22/2023
1.13.52 114 11/22/2023
1.13.51 123 11/7/2023
1.13.50 131 11/3/2023
1.13.49 134 10/24/2023
1.13.48 135 10/4/2023
1.13.47 146 9/8/2023
1.13.46 136 9/4/2023
1.13.45 148 8/27/2023
1.13.44 141 8/27/2023
1.12.43 145 8/25/2023
0.7.22 313 7/28/2022
0.7.21 293 7/28/2022

2023-11-22: Add pagination in the PDF. Update nugets to last version => DigitalDoor.Reporting.Entities 1.13.46 and iText 8.0.2.
 2023-11-07: Improved height management in text.
 2023-11-03: Fixed image positions when has rotation.
 2023-10-24: Fix Z-Index and Background Transparent
 2023-10-04: Fixed issue with borders, background colour and left position. Update nuget dependencies.
 2023-09-08: Add interface IReportFont can get a font in bytes[] to use your own Font in the report.
 2023-09-04: Fixed column jump to render correctly all pages. Improved how to manage angels when have rotations.
 2023-08-28: Add Register services extension method. Hide implementation to outside. Implement IReportAsBytes in a controller PDFReportController to get directly the PDF Bytes in only one injection.
 2023-08-10: Add Create PDF Using IText7 C#