How to print collection of reports
Posted: Thu Nov 01, 2012 7:49 pm
How would you print a collection of reports from code? Such as:
It throws an error because it doesn't wait for user to pick/print the first one before it tries to print the rest. Is there anywhere to say "here is a bunch of data (or StiReports), pick a printer and print them all"?
Code: Select all
foreach (var item in CollectionOfDataObjects)
{
var file = await RetrieveLabelFileFromLocalStorage("Report.mrt");
if (file == null)
{
DialogService.ShowErrorAsync(StringRetriever.GetString("csLabelService_GetLabelFileAsReport"));
return null;
}
// Create the report
StiReport report = new StiReport();
// Load the label file into the report
await report.LoadAsync(file);
// Register data as business objects
if (item != null)
report.RegBusinessObject("Data", "Data", item);
// Render the report
await report.RenderAsync();
// Print the Report
await StiPrintReport.PrintAsync(report);
}