Posted 19 August 2022, 7:23 am EST
Hi,
Apologize for the delay in response.
JFYI, C1MultiDocument is a legacy control and this is not available in C1FlexReport.
However, If your requirement is to combine all reports into one and save as pdf. Then you can do a workaround for this requirement.
You need to generate images for all pages of all reports and add to the another report through ImageField.(see code snippet)
Merge Reports:
/// <summary>
/// Method to get the merged report
/// </summary>
/// <param name="reports"> collection of reports to be merged</param>
/// <returns></returns>
private C1FlexReport MergeReports(ObservableCollection<C1FlexReport> reports)
{
// create a final report
var mergeFlex = new C1FlexReport();
mergeFlex.Sections.PageFooter.Height = 0;
mergeFlex.Sections.PageHeader.Height = 0;
mergeFlex.Sections.Header.Height = 0;
mergeFlex.Sections.Footer.Height = 0;
mergeFlex.Layout.MarginBottom = 0;
mergeFlex.Layout.MarginLeft = 0;
mergeFlex.Layout.MarginRight = 0;
mergeFlex.Layout.MarginTop = 0;
mergeFlex.Sections.Detail.AutoHeight = AutoSizeBehavior.GrowAndShrink;
mergeFlex.Sections.Detail.Visible = true;
// Iterate all pages of all reports.
foreach(var report in reports)
{
for (int i = 0; i < report.PageCount; i++)
{
// add page image to the final report
img = new ImageField();
SubSection section = mergeFlex.Sections.Detail.SubSections.Add();
section.Visible = true;
section.Height = mergeFlex.Layout.PageSize.Height;
section.AutoHeight = AutoSizeBehavior.None;
img.Picture = report.GetPageImage(i);
img.Left = 0;
img.Top = 0;
img.AutoWidth = AutoSizeBehavior.CanGrow;
img.AutoHeight = AutoSizeBehavior.GrowAndShrink;
section.Fields.Add(img);
}
}
return mergeFlex;
}
Save Merged reports to Pdf:
C1FlexReport mergeFlex = MergeReports(flexReports);
mergeFlex.Render();
PdfFilter f = new PdfFilter();
f.FileName = @"..\..\MergedReport.pdf";
mergeFlex.RenderToFilter(f);
Please refer the attached sample for the same: MergeFlexReport.zip
Best Regards,
Nitin