Data doesn't load subReport
Posted: Mon Sep 13, 2021 5:13 pm
I'm sending the fixed data to the subreport's dataSet, but when printing the subReport it doesn't load the data. I looked on the forum and saw that I wasn't using the "StiGetSubReportEventHandler" method. But when I put it in my project and try to run it, it seems that it doesn't run, that's because when running the debugger doesn't seem to go through breakPoint
Here is my code
*(I tried to send an example project, but it's giving an error to send)
Here is my code
Code: Select all
private StiReport ConfigurarStiReportTeste(byte[] arquivoRelatorioPrincipal, IEnumerable<DatasetPdfReportDTO> dados)
{
var report = new StiReport();
report.Load(arquivoRelatorioPrincipal);
report.CacheAllData = true;
report.Dictionary.DataSources.Clear();
foreach (var dado in dados)
{
report.RegData(dado.NomeDicionario, dado.Dados);
}
report.Dictionary.Synchronize();
report.GetSubReport += new StiGetSubReportEventHandler(Report_GetSubReport);
report.Render(false);
return report;
}
//meu Método
private void Report_GetSubReport(object sender, StiGetSubReportEventArgs e)
{
foreach(var dados in dadosSubReports)
{
byte[] arquivoSubrelatorio = ObterArquivoRelatorio(dados.IdentificacaoSubRelatorio);
var subreport = new StiReport();
subreport.Load(arquivoSubrelatorio);
subreport.CacheAllData = true;
subreport.Dictionary.DataSources.Clear();
subreport.RegData(dados.NomeDicionario, dados.Dados);
subreport.Dictionary.Synchronize();
e.Report = subreport;
}
}