Skip to Content
0
Former Member
Dec 10, 2008 at 12:24 PM

Adding new subreport to Crystal report

40 Views

Hi there,

I am trying to add a new subreport to an existing Crystal Report programmatically using RAS SDK unmanaged (VS2005). I am a bit confused about the samples to that topic, maybe you could give me a hint what I am doing wrong!

I do get the rpt files as a byte[] from the database. Therefore, I write a temp file from this rpt and add this to a section of my main report:

ReportDocument rptDoc = new ReportDocument();
.
.
.
byte[] rptContent = m_report.rptContent;

fileStream.Write(rptContent, 0, rptContent.Length);
fileStream.Close();

string chosenSection;
fSection formSection = new fSection(rptDoc.ReportDefinition.Sections);
formSection.ShowDialog();
chosenSection = formSection.GetSection();
CrystalDecisions.ReportAppServer.ReportDefModel.Section section = 
rasDoc.ReportDefController.ReportDefinition.FindSectionByName(chosenSection);

rptDoc.ReportClientDocument.SubreportController.ImportSubreport(selectedReport.reportText, "", section);

Unfortunately, nothing happens when this code has been processed.

Thanks for any hint,

Pascal