SimpleWPFReportingNETCore 1.0.1

dotnet add package SimpleWPFReportingNETCore --version 1.0.1
NuGet\Install-Package SimpleWPFReportingNETCore -Version 1.0.1
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="SimpleWPFReportingNETCore" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SimpleWPFReportingNETCore --version 1.0.1
#r "nuget: SimpleWPFReportingNETCore, 1.0.1"
#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 SimpleWPFReportingNETCore as a Cake Addin
#addin nuget:?package=SimpleWPFReportingNETCore&version=1.0.1

// Install SimpleWPFReportingNETCore as a Cake Tool
#tool nuget:?package=SimpleWPFReportingNETCore&version=1.0.1

SimpleWPFReporting for .NET Core

Reporting in WPF (XAML) made easy (Ported for .NET Core)

How to get it

SimpleWPFReporting package is available on NuGet

You can use Package Manager Console to get it:

PM> Install-Package SimpleWPFReportingNETCore 

How does it work

This project gives you the ability to create any report with the full power of WPF XAML. SimpleWPFReporting will take care of exporting it as a PDF or printing it. The important point is that SimpleWPFReporting will not rasterize your report before exporting or printing it.

In order to be able to divide any report into pages this project expects that you will use a vertical StackPanel as your report body. You should put your report elements into this StackPanel. SimpleWPFReporting accepts StackPanel as a parameter and automatically divides report elements into pages.

How to use it

The main API of SimpleWPFReporting consists of Report static class, ExportReportAsPdf method, and PrintReport method. Both of the methods accept the same arguments.

Required arguments

StackPanel reportContainer is your report body containing report elements.

object dataContext is the data context of your report.

Thickness margin is the margin applied to every report page. Both of the methods have overloads without the margin argument. They use Thickness(25) as a default margin.

ReportOrientation orientation is the orientation (Portrait or Landscape) of your report.

Optional arguments

ResourceDictionary resourceDictionary provides all the resources used in the report.

Brush backgroundBrush is the background brush of the report.

DataTemplate reportHeaderDataTemplate is the DataTemplate used to create a header for every page of the report.

bool headerOnlyOnTheFirstPage allows you to use a header only on the first page of the report. (default is false)

DataTemplate reportFooterDataTemplate is the DataTemplate used to create a footer for every page of the report.

bool footerStartsFromTheSecondPage allows you to not use a footer on the first page of the report. (default is false)

Page number

Every header and footer will be supplied with the PageNumber dynamic resource. You can use it as you wish. For example, this is the simplest possible footer DataTemplate:

<DataTemplate x:Key="ReportFooterDataTemplate">
    <TextBlock Text="{DynamicResource PageNumber}" HorizontalAlignment="Right"/>
</DataTemplate>

Example

Report view:

Alt text

Output PDF:

Alt text Alt text

As you can see there is no difference between input (XAML) and output (PDF) except for paging. The subtle difference in the font weight and the width of the lines is due to artifacts of scaling of the screenshots. PDF is not rasterized, as you can see for yourself: pdf.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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.0.1 477 2/1/2021
1.0.0 302 2/1/2021

Support Flow Direction