Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
U

User 10147035

@User 10147035
About
Posts
1
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to use FastReport .frx file in .NET WinUI3 App?
    U User 10147035

    Good day, i have a report being designed in FastReport App, jus to use it in .NET MAUI or WinUI3 desktop App, it seems there is not visual designer for MAUI or WinUI3 for creating reports, and FastReport doesn't offer native support:

    example report

    My problem is that it shows only the first record in the dataset i had created in C#:

    Result

    Here is my code:

    private async void ImprimirRecibo(object obj)
    {
        try
        {
            using (FastReport.Report reporte = new FastReport.Report())
            {
                string path = Path.Combine(AppContext.BaseDirectory, "Assets", "report1.frx");
                reporte.Load(path);
    
                int numeroRecibo = _recibo.idrecibos;
                reporte.SetParameterValue("nro_recibo", numeroRecibo);
                System.Diagnostics.Debug.WriteLine($"recibo: " + numeroRecibo);
    
                DataTable dt = await _reciboService.ListadoRecdAsync(numeroRecibo);
                dt.TableName = "Item";
                foreach (DataColumn col in dt.Columns)
                {
                    System.Diagnostics.Debug.WriteLine($"Columna disponible: {col.ColumnName}");
                }
    
    
                // Registrar DataTable con el mismo nombre que en el XSD
                reporte.RegisterData(dt, "Item");
       
    
                // Obtener el DataSource especĂ­fico y asignarlo a la DataBand
                var dataSource = reporte.GetDataSource("Item");
             
    
                // Habilitar el datasource
                dataSource.Enabled = true;
    
                // Preparar reporte
                reporte.Prepare();
    
                using (MemoryStream ms = new MemoryStream())
                {
                    var export = new PDFSimpleExport();
                    reporte.Export(export, ms);
                    ms.Position = 0;
    
                    string tempFile = Path.Combine(Path.GetTempPath(), $"recibo_{numeroRecibo}.pdf");
                    await File.WriteAllBytesAsync(tempFile, ms.ToArray());
    
                    var ventanaPdf = new PdfViewerWindow(tempFile);
                    ventanaPdf.Activate();
                }
            }
        }
        catch (Exception ex)
        {
            System.Diagnostics.Debug.WriteLine($"Error al imprimir: {ex.Message}");
        }
    }
    
    Windows Development
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups