This is a migrated thread and some comments may be shown as answers.

A few issues with SubReports

3 Answers 214 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 20 Jan 2012, 05:33 PM
I have a class called clsInvoice.  I have a report called InvoiceReport. When InvoiceReport is created, the DataSource is assigned to be a clsInvoice.  Then I assign a few images on the report manually.  Then I preview the report.  All is well.

Now I want to print multiple invoices.  I created a new report MultInvoiceReports.  I added a detail band only.  I added a SubReport to this band, and set it to be an InvoiceReport.  My InvoiceReports data source is an ObservableCollection<clsInvoice>.

I tried for a long time to get bindings to work.  I never could.  Eventually I used the NeedDataSource method and manually assigned it.  The images I was creating and assigning did not print, but the report worked otherwise.

Next, I removed the subreport from the designer, and tried everything manually:
foreach (clsInvoice c in InvoiceList)
{
  // Create a new InvoiceReport
  // set the data source to c
  // Assign my images
  // Create a subreport
  // Set the ReportSource to the InvoiceReport
  // Find the DetailSection in MultInvoiceReports and add the subreport to DetailSections.Items.
}

This makes the reports all show, however there are 4 to 7 blank pages between sub reports, and again my images do not work.

Is there a better way to do this?

3 Answers, 1 is accepted

Sort by
0
Paul
Top achievements
Rank 1
answered on 20 Jan 2012, 05:54 PM
Two updates.  The blank pages inserted are equal to the number of invoices total.  

If I print for 2 invoices, I get:  [Invoice 1] - [2 blank pages] - [invoice 2].
If I print for 3 invoices, I get:  [Invoice 1] - [3 blank pages] - [invoice 2] - [3 blank pages] - [invoice 3].

On the images not showing, I am noticing that the actual problem is my entire header section from my InvoiceReport is not showing in the subreport.  I found a few threads about this from 2007, but nothing recent.  Is this still a limitation?
0
Accepted
Steve
Telerik team
answered on 24 Jan 2012, 05:23 PM
Hi Paul,

Thank you for the detailed information on the problems you've encountered and up to your questions:
  • blank pages: as noted in the Telerik Reporting renders blank pages KB article, there are several cases when this could happen:
    1. Report Width is greater than than the available page space (Page Width - Left Margin - Right Margin).
    2. There is a sub-report, which contains a report that is too wide and it would cause carry over to occur. Make sure the InvoiceReport size is not bigger than the size of MultInvoiceReports report. If they are equal in size, make sure the SubReport item location starts at 0.
    3. There is a report item with boundaries going out to the right from its parent section.

      The blank pages are equal to the number of subreport items as if the SubReport is carried over, it would create a second page, respectively for each subreport an additional second page would be created.
  • images not showing: are these images in page sections? If so, be aware that page sections of nested/detail reports are ignored and only the page sections of the main report are visible. This is due to the fact that page sections are not related to the report itself, but are relative to the paper or screen i.e. you have a single page header/footer on a real paper. This information is available in the SubReport help article.
    In order to have sections that repeat on every page similar to page sections, consider using an unbound group (no grouping criteria specified) and set the PrintOnEveryPage property of its sections to True. Be aware that you cannot use PageCount and PageNumber global objects in group sections.
Kind regards,
Steve
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
Paul
Top achievements
Rank 1
answered on 24 Jan 2012, 08:27 PM
I ended up scrapping the sub report and creating a new report to handle it.  You are correct on the image part.  On the extra pages issue, that may be the case but there's no way for me to know anymore.  I will mark this as the answer.
Tags
General Discussions
Asked by
Paul
Top achievements
Rank 1
Answers by
Paul
Top achievements
Rank 1
Steve
Telerik team
Share this question
or