Easy.Data.Export.Document 1.0.0

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

Easy.Data.Export.Document

Permite crear documentos tipo (XLSX, CSV, PDF) de forma rápida y sencilla.

//FrontEnd
private async Task ExportarData(ExtensionTipoArchivo extension)
{
try
{
    string columns = "Column1, Column2, Column3";

    //var path = $"../prueba/document.{extension}";

    var request = new ExportFile()
        {
            FiltrosPaginacion = _request,
            Columnas = columns,
            Total = _count,
            Nombre = $"document.{extension}",
            Documento = extension,
            Lugar = null //Define path for save on location
        };

    var fileResult = await ExportDataFile(request);

    if (fileResult is not null)
    {

        byte[] fileBytes = fileResult.FileContents;
        var fileName = fileResult.FileDownloadName;

        await js.InvokeVoidAsync("downloadFileFromResult", fileBytes, fileName);

    }
}
catch (Exception ex)
{
    Console.WriteLine($"\n{ex.Message}\n{ex.InnerException}\n");       
}

//Index.html
<script>
//Metodos para descargar documento
function triggerFileDownload(fileName, url) {
    const link = document.createElement('a');
    link.href = url;
    link.download = fileName;
    document.body.appendChild(link);
    link.click();
    document.body.removeChild(link);
}

async function downloadFileFromResult(fileBytes, fileName) {
    const blob = new Blob([fileBytes]);
    const url = URL.createObjectURL(blob);
    triggerFileDownload(fileName, url);
    URL.revokeObjectURL(url);
}
</script>


//BackEnd
public async Task<FileContentResult> ExportDataFile(FiltrosPaginacion filtro, string fields, string name, TypeFile extension, string filePath)
{
    var data = await dataRepository.GetAllQueryable(filtro);

    var generador = new GenerardorDeArchivos<DataDTo>()
    {

        Data = data,
        Fields = fields,
        Name = name,
        Extension = extension,
        FilePath = filePath

    };

    var result = generador.ExportToFile();

    return result;
}   
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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
1.0.0 7,907 1/29/2024

Initial version (Alpha)