I am very close to solving the elusive single-pass bursting and need some help. I have a button that exports a new .rpt with saved data and my idea was to then query this saved data report and GET the necessary info. I can access a formula but it returns the actual CR syntax and not the printed value. How can I get the actual value?
Also if anyone knows how to get the group header #1 value that would also be great.
Thanks
Issue with:
formulaField.Text
public void btnExportToPDF_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(destinationFolderFinal))
{
ReportDocument savedReport = new ReportDocument();
savedReport.Load(destinationFolderFinal);
viewer.ReportSource = savedReport;
viewer.Refresh();
Section groupHeaderSection = savedReport.ReportDefinition.Sections["GroupHeaderSection1"];
FormulaFieldDefinition formulaField = savedReport.DataDefinition.FormulaFields["BURST"];
string formulaValue = formulaField.Text;
string sanitizedFormulaValue = SanitizeFilename(formulaValue.ToString());
string pdfFileName = sanitizedFormulaValue + ".pdf";
string pdfFilePath = Path.Combine(destinationFolder, pdfFileName);
savedReport.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
savedReport.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
DiskFileDestinationOptions diskOptions = new DiskFileDestinationOptions
{
DiskFileName = pdfFilePath
};
savedReport.ExportOptions.DestinationOptions = diskOptions;
savedReport.Export();
MessageBox.Show("Report exported to PDF.");
}
else
{
MessageBox.Show("Please select a destination folder first.");
}
}
I handled the Crystal Report PDF bursting in a different way:
Add "Burst to PDF" button to export report to temp pdf and add bookmark tree based on report groups.
Then split/burst this temp pdf based on the second level bookmarks.
Delete temp pdf.
In my testing I managed to split 1000 PDFs with random page numbering in 30 seconds.