SolarBlazorDocs.Excel 10.0.0

dotnet add package SolarBlazorDocs.Excel --version 10.0.0
                    
NuGet\Install-Package SolarBlazorDocs.Excel -Version 10.0.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="SolarBlazorDocs.Excel" Version="10.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SolarBlazorDocs.Excel" Version="10.0.0" />
                    
Directory.Packages.props
<PackageReference Include="SolarBlazorDocs.Excel" />
                    
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 SolarBlazorDocs.Excel --version 10.0.0
                    
#r "nuget: SolarBlazorDocs.Excel, 10.0.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 SolarBlazorDocs.Excel@10.0.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=SolarBlazorDocs.Excel&version=10.0.0
                    
Install as a Cake Addin
#tool nuget:?package=SolarBlazorDocs.Excel&version=10.0.0
                    
Install as a Cake Tool

SolarBlazorDocs.Excel

Motor de conversión a Excel (xlsx) para SolarBlazorDocs, basado en ClosedXML (OpenXML). Renderiza el componente Blazor a HTML, extrae sus tablas (<table>) y vuelca cada una en una hoja del libro.

Requiere el paquete núcleo SolarBlazorDocs.Abstractions (se instala como dependencia).

Instalación

dotnet add package SolarBlazorDocs.Excel

Registro

using SolarBlazorDocs.Extensions;

builder.Services.AddSolarBlazorDocs(docs =>
{
    docs.AddClosedXmlExcelEngine();
});

AddClosedXmlExcelEngine registra el motor con nombre closedxml (valor por defecto de ExcelRenderOptions.Engine).

Uso

byte[] xlsx = await docs.ComponentToExcelAsync<Factura>(parametros, new ExcelRenderOptions
{
    SheetName = "Factura",
    FirstRowAsHeader = true,
    AutoFitColumns = true,
    IncludeAllTables = true,
    HeaderBackgroundColor = "#007bff",
    Culture = "es-ES"
});

También puedes convertir un HTML ya preparado:

byte[] xlsx = await docs.HtmlToExcelAsync("<table>…</table>", new ExcelRenderOptions());

Opciones (ExcelRenderOptions)

Propiedad Descripción
SheetName Nombre base de la hoja. Con varias tablas se numeran (Factura 1, Factura 2, …).
FirstRowAsHeader Aplica estilo de cabecera (negrita + fondo) a la primera fila.
AutoFitColumns Ajusta el ancho de columnas al contenido.
IncludeAllTables true = una hoja por tabla; false = solo la primera.
HeaderBackgroundColor Color de fondo de la cabecera (hex CSS).
Culture Cultura del render (i18n).
Engine Nombre del motor (closedxml).

Comportamiento

  • Cada <table> del HTML se convierte en una hoja. Las celdas numéricas puras se escriben como número; el resto, como texto.
  • Si el HTML no contiene ninguna tabla, se lanza InvalidOperationException con un mensaje claro.
  • Los nombres de hoja se truncan a 31 caracteres (límite de Excel).

Requisitos

  • .NET 10

Contenido del paquete

  • ClosedXmlExcelEngine — implementación de IExcelEngine (nombre closedxml).
  • AddClosedXmlExcelEngine() — extensión de registro sobre SolarBlazorDocsBuilder.
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
10.0.0 198 7/25/2026