Append prepared pages
Hello,
I'am using this code to append prepared pages from multiple (prepared) reports to new report and show all results in one report preview window (without tabs) and everything works great if report doesn't have subreports. If it does, it throws an exception.
Code:
Exception (when report has subreports):
I got this code from expermenting with various solutions and it's most close to that what I need.
Any advice from your side?
Thanks in advance
Ivica
I'am using this code to append prepared pages from multiple (prepared) reports to new report and show all results in one report preview window (without tabs) and everything works great if report doesn't have subreports. If it does, it throws an exception.
Code:
                    FastReport.Report rep = new FastReport.Report();
                    rep.Prepare();
                    var ind = 0;
                    foreach (FastReport.Report pp in reports)
                    {
                        for (int i = 0; i < pp.PreparedPages.Count; i++)
                        {
                            var page = pp.PreparedPages.GetPage(i);
                            rep.PreparedPages.AddSourcePage(page);
                            rep.PreparedPages.AddPage(page);
                            rep.PreparedPages.ModifyPage(ind, page);
                            ind++;
                        }
                    }
Exception (when report has subreports):
Objekt tipa ReportSummaryBand ne mo??e sadr??avati objekte tipa DataHeaderBand
(Object of type ReportSummaryBand can't contain objects of type DataHeaderBand)
Stack trace:
at FastReport.Base.SetParent(Base value)
at FastReport.Utils.FRCollectionBase.OnInsert(Int32 index, Object value)
at System.Collections.CollectionBase.System.Collections.IList.Add(Object value)
at FastReport.BandBase.AddChild(Base child)
at FastReport.Base.set_Parent(Base value)
at FastReport.Preview.SourcePages.CloneObjects(Base source, Base parent)
at FastReport.Preview.SourcePages.CloneObjects(Base source, Base parent)
at FastReport.Preview.SourcePages.CloneObjects(Base source, Base parent)
at FastReport.Preview.SourcePages.Add(ReportPage page)
at IPIS.StatusListControl.(Object , ItemClickEventArgs )
at DevExpress.XtraBars.BarItem.OnClick(BarItemLink link)
at DevExpress.XtraBars.BarBaseButtonItem.OnClick(BarItemLink link)
at DevExpress.XtraBars.BarItemLink.OnLinkClick()
at DevExpress.XtraBars.BarItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
at DevExpress.XtraBars.BarButtonItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
at DevExpress.XtraBars.BarItemLink.OnLinkActionCore(BarLinkAction action, Object actionArgs)
at DevExpress.XtraBars.ViewInfo.BarSelectionInfo.ClickLink(BarItemLink link)
at DevExpress.XtraBars.ViewInfo.BarSelectionInfo.UnPressLink(BarItemLink link)
at DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnUnPressItem(DXMouseEventArgs e, RibbonHitInfo hitInfo)
at DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnUnPress(DXMouseEventArgs e, RibbonHitInfo hitInfo)
at DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnMouseUp(DXMouseEventArgs e)
at DevExpress.XtraBars.Ribbon.Handler.RibbonHandler.OnMouseUp(DXMouseEventArgs e)
at DevExpress.XtraBars.Ribbon.RibbonControl.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at DevExpress.Utils.Controls.ControlBase.WndProc(Message& m)
at DevExpress.XtraBars.Ribbon.RibbonControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I got this code from expermenting with various solutions and it's most close to that what I need.
Any advice from your side?
Thanks in advance
Ivica
Comments
Sorry for taking your time!
Ivica