Posted 27 December 2019, 12:14 am EST
Hello,
Thanks to this thread, I’m able to perform a merge with multiple reports
https://www.grapecity.com/forums/winforms-edition/merging-multiple-flexrepor
I’m not using the exact provided code , however I can see a difference between exporting the original report and the merged one. For now, I only have one example. The export_merged.pdf is cutting some pixels on the word “CORTESIA” (below the word Convênio, in the header). While the exact same report exported by itself, does not have those pixels cut off.
I’m using the following code
// Exporting by itself
C1FlexReport c1FlexReport1 = new C1FlexReport();
c1FlexReport1.Load("..\\..\\1_00001#15684563#CORT^CORT.flxr", "0 - Laudos");
C1.Win.C1Document.Export.PdfFilter exp = new C1.Win.C1Document.Export.PdfFilter();
exp.FileName = "export_single.pdf";
c1FlexReport1.Export(exp);
//Exporting merged. Even though here is just one report
List<C1FlexReport> lstRep = new List<C1FlexReport>();
lstRep.Add(c1FlexReport1);
C1FlexReport 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;
foreach (C1FlexReport flex1 in lstRep)
{
//OBS: WITHOUT THIS RENDER THE PAGE COUNT IS ALWAYS ZERO. IS THIS CORRECT ?
flex1.Render();
for (int i = 0; i < flex1.PageCount; i++)
{
SubSection section = mergeFlex.Sections.Detail.SubSections.Add();
section.Visible = true;
section.Height = mergeFlex.Layout.PageSize.Height;
section.AutoHeight = AutoSizeBehavior.None;
ImageField img = new ImageField();
img.Picture = flex1.GetPageImage(i);
img.Left = 0;
img.Top = 0;
img.AutoWidth = AutoSizeBehavior.CanGrow;
img.AutoHeight = AutoSizeBehavior.GrowAndShrink;
section.Fields.Add(img);
}
}
C1.Win.C1Document.Export.PdfFilter exp2 = new C1.Win.C1Document.Export.PdfFilter();
exp2.FileName = "export_merged.pdf";
mergeFlex.Export(exp2);
I’m afraid that my clients have custom reports and after doing this merge the final version it’s gonna be different. So I’m asking if Is there a way around the code, without touching the report ? Or Am I missing something here ?
I’m using the 4.0.20193.393 version