Cayaqui.MPS.Reports 0.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Cayaqui.MPS.Reports --version 0.3.0
                    
NuGet\Install-Package Cayaqui.MPS.Reports -Version 0.3.0
                    
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="Cayaqui.MPS.Reports" Version="0.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cayaqui.MPS.Reports" Version="0.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Cayaqui.MPS.Reports" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Cayaqui.MPS.Reports --version 0.3.0
                    
#r "nuget: Cayaqui.MPS.Reports, 0.3.0"
                    
#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.
#:package Cayaqui.MPS.Reports@0.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Cayaqui.MPS.Reports&version=0.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Cayaqui.MPS.Reports&version=0.3.0
                    
Install as a Cake Tool

Cayaqui.MPS.Reports — 0.3.0

Generación de reportes Excel · Word · PowerPoint · PDF basada en templates OpenXML, para .NET 10. Usa Syncfusion File Formats (XlsIO, DocIO, Presentation) — .xlsx/.docx/.pptx nativos con MailMerge, template markers y placeholder replacement.

Distribución propietaria — requiere contrato comercial con Cayaqui. Ver LICENSE.txt.

Dependencias: Cayaqui.MPS.Storage registrado (para cargar templates + GenerateAndStoreAsync) + licencia Syncfusion válida del consumidor.

Novedades 0.3.0

  • 🐛 Fix XlsIO markers — root cause del issue 0.2.0: el parser de XlsIO 33.2.3 captura el % de cierre como parte del variable name. Workaround aplicado; markers ahora reemplazan correctamente.
  • 📄 PDF metadata — Title, Author, Subject, Keywords, Creator via DocumentInformation
  • 🗄️ PDF/A-1b / 2b / 3b conformance para archivio ISO 19005
  • RequiredFields + RequiredFieldsMode — fail-fast/warn/ignore si el data context no trae los campos esperados
  • 🖼️ Image injection — placeholders {{image:key}} (Word/PPT) y %image:key% (Excel) mapean a ReportImage del dict
  • 🧱 ReportContext fluent builderReportContext.Create().With(...).WithCollection(...).WithImage(...)
  • 💧 Excel + PowerPoint watermark — cierra la limitación documentada en 0.2.0 (watermark shape por sheet/slide)
  • 🧪 +16 tests (total 50) — PDF metadata, PDF/A smoke, RequiredFields (4 modos), ReportContext, image injection (Word/Excel/PPT), XlsIO regression

Novedades 0.2.0 (referencia)

Security (path traversal), ReportRenderException, logging, ReportRenderOptions (Header/Footer/Watermark/PdfPassword/DryRun), GenerateAndStoreAsync, GenerateExcelMultiSheetAsync, ValidateTemplateAsync, ITemplateCatalog, Word watermark + PDF post-processor.

Instalación

dotnet add package Cayaqui.MPS.Reports
dotnet add package Cayaqui.MPS.Storage

Uso — ReportContext fluent

var ctx = ReportContext.Create()
    .With("ProjectCode", "LBX-01")
    .With("ControlDate", DateTime.UtcNow)
    .With("Customer", new { FullName = "Acme Corp", TaxId = "12345-6" })
    .WithCollection("Items", invoice.Lines)
    .WithImage("logo", File.ReadAllBytes("logo.png"), "image/png")
    .WithImage("signature", signatureBytes);

await using var pdf = await reports.GenerateAsync(
    "invoice.docx",
    ctx.Build(),
    format: ReportFormat.Pdf,
    options: ctx.ToOptions(new ReportRenderOptions
    {
        PdfTitle = "Invoice {invoice.Number}",
        PdfAuthor = "Cayaqui",
        PdfConformance = PdfConformance.PdfA2b,
        RequiredFields = new[] { "ProjectCode", "ControlDate" },
        RequiredFieldsMode = RequiredFieldsMode.Throw
    }));

Uso — Image injection

Template Word (invoice.docx):

Invoice for {{image:logo}} — issued {{ControlDate}}
...
Signature: {{image:signature}}

Template Excel (report.xlsx), cell B1: %image:logo%, cell B20: %image:signature%.

Template PowerPoint (cover.pptx), text box with content {{image:logo}} en el centro del slide 1.

await reports.GenerateAsync("invoice.docx", data,
    options: new ReportRenderOptions
    {
        Images = new Dictionary<string, ReportImage>
        {
            ["logo"] = new ReportImage { Data = logoBytes, ContentType = "image/png",
                                          WidthPx = 120, HeightPx = 40 },
            ["signature"] = new ReportImage { Data = sigBytes, ContentType = "image/png" }
        }
    });

Uso — PDF metadata + PDF/A

var opts = new ReportRenderOptions
{
    PdfTitle = "Monthly Status — April 2026",
    PdfAuthor = "Project Controls Team",
    PdfSubject = "EVM snapshot for LBX-01",
    PdfKeywords = "evm;cpi;spi;monthly;lbx-01",
    PdfCreator = "MPS",
    PdfConformance = PdfConformance.PdfA2b
};
await using var pdf = await reports.GenerateAsync("monthly-status.docx", data,
    format: ReportFormat.Pdf, options: opts);

Uso — RequiredFields

try
{
    await reports.GenerateAsync("invoice.docx", data,
        options: new ReportRenderOptions
        {
            RequiredFields = new[] { "CustomerName", "InvoiceTotal", "DueDate" },
            RequiredFieldsMode = RequiredFieldsMode.Throw
        });
}
catch (ReportRenderException ex) when (ex.Message.Contains("Required fields"))
{
    _log.LogError("Invoice data incomplete: {Message}", ex.Message);
}

Watermark (all formats 0.3.0)

Formato Implementación
Word DocIO TextWatermark diagonal, semitransparente
Excel Shape de texto centrado por sheet (no rotado — ver limitaciones)
PowerPoint Text box rotado -45° por slide
PDF Overlay post-conversion con rotación y opacity
await reports.GenerateAsync("doc.docx", data,
    options: new ReportRenderOptions
    {
        Watermark = "CONFIDENTIAL",
        WatermarkColor = "#E5E7EB"
    });

Convenciones de template (unchanged)

Formato Syntax Image syntax
Word .docx MailMerge «Field» + groups «TableStart:Items»...«TableEnd:Items» {{image:key}} en paragraph
Excel .xlsx Template markers %Field%, %Collection.Prop% %image:key% en celda
PowerPoint .pptx {{Field}} + slide foreach {{#foreach Items}}...{{/foreach}} {{image:key}} en text box

Limitaciones conocidas

  • Excel watermark: shape no rotado en 0.3.0 (XlsIO 33.x limitation en ITextBoxShape.Rotation). El watermark aparece horizontal. Workaround: diseñar watermark en el template mismo o usar PDF output con rotation.
  • Image injection: el placeholder literal se reemplaza pero el fit/scale de la imagen depende de las dims provistas; si no se especifican, se usa el tamaño natural — puede desbordar el layout.

Requisitos

  • .NET 10.0 o superior
  • Cayaqui.MPS.Storage registrado
  • Licencia Syncfusion Essential Studio registrada en el consumidor
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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
0.6.1 34 5/25/2026
0.5.0 242 5/6/2026
0.4.2 94 5/6/2026
0.4.1 203 4/25/2026
0.4.0 214 4/24/2026
0.3.1 104 4/24/2026
0.3.0 109 4/24/2026

0.3.0 — Tier 1 improvements: fix XlsIO 33.2.3 template-markers parser quirk (workaround in ExcelReportRenderer, verified by regression test); PDF metadata (Title/Author/Subject/Keywords/Creator) via DocumentInformation; PDF/A-1b/2b/3b conformance via converter settings; RequiredFields[] + RequiredFieldsMode (Throw/Warn/Ignore) fail-fast validation; Excel and PowerPoint watermark (shape-based, complementing existing Word+PDF); placeholder-based image injection ({{image:key}} for Word/PPT, %image:key% for Excel) backed by ReportImage (byte[] + contentType + optional dimensions); ReportContext fluent builder (Create().With(...).WithCollection(...).WithImage(...)) backed by ExpandoObject and DataBinding IDictionary support. +16 tests (total 50). Backward compatible.