BReportingService - Esempi
Rendering locale RDLC
using B.BReports;
BReportingService reports = new(BReportingService.eEngine.BReportEngine)
{
ReportFolder = @"C:\Reports"
};
BReport report = new("Fattura.rdlc", "Fattura_1001")
{
DataSource = reportDataSet,
Format = BReport.eExport.PDF,
Result = BReport.eResult.Download
};
BReportResult result = await reports.RenderAsync(report);
byte[]? contenuto = result.File?.Content;
Parametri e sottoreport locali
BReport report = new(
"Ordine.rdlc",
new B.BData.BParameter("@OrdineID", "1001"));
report.DataSource = ordineDataSet;
report.SubReports.Add("RigheOrdine", righeDataSet);
BReportResult result = await reports.RenderAsync(report);
La chiave di SubReports deve coincidere con il ReportPath richiesto dal sottoreport.
Rendering remoto SSRS
BReportingService reports = new(
BReportingService.eVersion.Current,
"reportserver.azienda.local",
SSL: true)
{
UseDefaultCredential = true,
ReportFolder = "Gestionale"
};
BReport report = new("Fattura", "Fattura_1001")
{
Format = BReport.eExport.PDF,
Result = BReport.eResult.Download
};
BReportResult result = await reports.RenderAsync(report);
byte[]? contenuto = result.File?.Content;
Pubblicazione nel catalogo SSRS
BReportingService reports = new(
BReportingService.eVersion.Current,
"reportserver.azienda.local",
SSL: true)
{
UseDefaultCredential = true,
ReportFolder = "Gestionale",
DBReportServer = "sqlserver.azienda.local",
DBReportDatabase = "Gestionale",
DBReportUsername = "utente_report",
DBReportPassword = passwordCifrata
};
await reports.CreateReportFolderAsync();
await reports.CreateDataSourceAsync();
bool pubblicato = await reports.CreateReportAsync("Fattura", definizioneRdl);
if (!pubblicato)
string log = reports.GetTextLog();
passwordCifrata deve essere compatibile con BCrypter.Decrypt; definizioneRdl contiene i byte del file .rdl.
