Question on combining reports

Stimulsoft Reports.WPF discussion
Post Reply
chris.procter
Posts: 32
Joined: Wed Jun 10, 2009 4:48 pm
Location: Edmonton

Question on combining reports

Post by chris.procter »

In a recent thread, Aleksey describes two methods to combine reports. (Headers not working right).

As it turns out, we'd like to convert a series of reports (many customer printouts) in to one single report. I had some initial luck with the first method (pasting rendered pages in to a single report), but the second doesn't work for me.

We have the .Wpf version, and so I changed the line

Code: Select all

mainReport.Render();
to

Code: Select all

mainReport.RenderWithWpf();
Unfortunately, at this point I get an error saying that Stimulsoft.Report.Win couldn't be found.

Does this seem like a bug? It looks to me like dynamically-added subreports aren't being rendered with the Wpf engine (the only one we have).
We're using the custom prerelease from the 21st that you provided, if that helps.

Aleksey wrote:Hello,

In this case, the main report can be obtained either by adding the pages of your other reports using the following code:

Code: Select all

StiReport mainReport = new StiReport();
mainReport.RenderedPages.Clear();
mainReport.NeedsCompiling = false;
mainReport.IsRendered = true;
for (int i = 1; i < repCount; i++)
{
    StiReport repDeatil = new StiReport();
    repDeatil.Load(repArray[i]);
    repDeatil.Render();
    foreach (StiPage repPage in repDeatil.RenderedPages)
    {
        repPage.Report = newreport;
        mainReport.RenderedPages.Add(repPage);
    }
}
mainReport.Show();
or by adding your additional reports to the SubReports collection of the main report, in this case they are rendered as separate reports:

Code: Select all

StiReport mainReport = new StiReport();
mainReport.Load("");
for (int i = 1; i < repCount; i++)
{
    StiReport repDeatil = new StiReport();
    repDeatil.Load("");
    mainReport.SubReports.Add(detailReport);
}
mainReport.Render();
mainReport.Show();
Thank you.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Question on combining reports

Post by Alex K. »

Hello,

Please use the following commands:

Code: Select all

report.RenderWithWpf(true);
report.ShowWithWpf();
Thank you.
chris.procter
Posts: 32
Joined: Wed Jun 10, 2009 4:48 pm
Location: Edmonton

Question on combining reports

Post by chris.procter »

Sorry, I'm still getting the same error.
Here's a stacktrace with the "true" argument if that's helpful:

Code: Select all

System.Exception was unhandled by user code
  Message=Assembly 'Stimulsoft.Report.Win' is not found
  Source=Stimulsoft.Report
  StackTrace:
       at Stimulsoft.Report.StiGuiOptions.GetProgressInformation(Object ownerForm, StiGuiMode guiMode)
       at Stimulsoft.Report.StiGuiOptions.GetProgressInformation(StiGuiMode guiMode)
       at Stimulsoft.Report.StiReport.Render(StiRenderState renderState, StiGuiMode guiMode)
       at Stimulsoft.Report.StiReport.Render(StiRenderState renderState)
       at Stimulsoft.Report.Engine.StiReportV2Builder.RenderSubReports(StiReport ownerReport, StiRenderState renderState)
       at Stimulsoft.Report.StiReport.RenderReport(StiRenderState renderState)
       at Stimulsoft.Report.StiReport.Render(StiRenderState renderState, StiGuiMode guiMode)
       at Stimulsoft.Report.StiReport.RenderWithWpf(StiRenderState renderState)
       at Stimulsoft.Report.StiReport.RenderWithWpf(Boolean showProgress, Int32 fromPage, Int32 toPage)
       at Stimulsoft.Report.StiReport.RenderWithWpf(Boolean showProgress)
       at Company.Admin.Wpf.DialogCheques.btnExperiment_Click(Object sender, RoutedEventArgs e) in C:\Pleasant\Projects\Company\Source\Company.Admin.Wpf\DialogCheques.xaml.cs:line 109
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.Controls.Button.OnClick()
       at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
       at System.Windows.Input.InputManager.ProcessStagingArea()
       at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
       at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
       at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
  InnerException: 
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Question on combining reports

Post by Alex K. »

Hello,

Check the following code:
1:

Code: Select all

StiReport mainReport = new StiReport();
mainReport.RenderedPages.Clear();
mainReport.NeedsCompiling = false;
mainReport.IsRendered = true;
for (int i = 1; i < repCount; i++)
{
    StiReport repDeatil = new StiReport();
    repDeatil.Load(repArray[i]);
    repDeatil.RenderWithWpf(true);
    foreach (StiPage repPage in repDeatil.RenderedPages)
    {
        repPage.Report = repDeatil;
        mainReport.RenderedPages.Add(repPage);
    }
}
mainReport.ShowWithWpf();
2:

Code: Select all

StiReport mainReport = new StiReport();
mainReport.Load();
for (int i = 1; i < repCount; i++)
{
    StiReport repDeatil = new StiReport();
    repDeatil.Load();
    mainReport.SubReports.Add(repDeatil);
}
mainReport.RenderWithWpf();
mainReport.ShowWithWpf();
This code works correctly without errors.

Thank you.
chris.procter
Posts: 32
Joined: Wed Jun 10, 2009 4:48 pm
Location: Edmonton

Question on combining reports

Post by chris.procter »

Thanks for the reply; we've been very busy with other things for a while.

I used the first method, but we're trying to combine hundreds, possibly thousands of reports, and got the error:
System.Exception: error CS1647: An expression is too long or complex to compile

at Stimulsoft.Report.StiReport.Compile(String path, Stream stream, StiOutputType outputType, Boolean autoCreate, Object standaloneReportType)

at Stimulsoft.Report.StiReport.Compile()

at Stimulsoft.Report.Engine.StiReportV2Builder.RenderSingleReport(StiReport masterReport, StiRenderState renderState)

at Stimulsoft.Report.StiReport.RenderReport(StiRenderState renderState)

at Stimulsoft.Report.StiReport.Render(StiRenderState renderState, StiGuiMode guiMode)

at Stimulsoft.Report.StiReport.RenderWithWpf(Boolean showProgress)


The second method still returns the "Stimulsoft.Report.Win not found" error.
I've made a small solution to demonstrate the problem (which should be attached).
Attachments
668.Stimulsoft_Concatenation.zip
(22.72 KiB) Downloaded 463 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Question on combining reports

Post by Alex K. »

Hello,

Please check the latest prerelease build from 27-10-2010.

Thank you.
chris.procter
Posts: 32
Joined: Wed Jun 10, 2009 4:48 pm
Location: Edmonton

Question on combining reports

Post by chris.procter »

Huzzah! Thanks; method 2 now works in 2010.10.27

I'm off to see if this method fits my specific requirements. :-)
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Question on combining reports

Post by Jan »

Hello,

Please contact us if you need any help.

Thank you.
Post Reply