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:
My problem is that it shows only the first record in the dataset i had created in C#:
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}");
}
}