Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1280
Reporting with a UserControl doesn't create multiple pages.
posted

Hello,

I have been testing the Reporting tools from infragistics.

According to the sample browser it should be possible to print any UIElement.

Therefor I created a UserControl as a template for the layout. And the UserControl contains the XamDataGrid with the data along with some other elements like label, image, border etc.

When I provide the reportObj.Sections with UserControl it only creates one page, and all the data is on one page.

on the other hand if I provide reportObj.Sections with XamDataGrid then it creates multiple pages.

I am aware that I can use a Style for PagePresenterStyle like this:

EmbeddedVisualReportSection section = new EmbeddedVisualReportSection(XamDataGrid1);
            section.PagePresenterStyle = this.TryFindResource("PagePresenterStyle") as System.Windows.Style;

But that will apply the style on all pages, and that not what I want. Beside I have to provide data for the other items/elements which has to be on the page.

Is this somehow possible to fix ?

Side question: Is it possible to export the report to PDF instead of XPS ??

Parents
  • 34830
    Verified Answer
    Offline posted

    Hello Nawed,

    Thank you for your post.

    I have been investigating into this issue, and the behavior you are currently seeing is expected. The XamDataGrid internally implements an interface named IEmbeddedVisualPaginatorFactory. This interface is implemented in the way that a Create() method is called when the grid export takes place, and when this method is called, a DataPresenterReportControl is created for the XamDataGrid, which paginates the grid and exports the pages. When you pass your UserControl to the Export method, this interface never gets used, as you are exporting the UserControl, and not the XamDataGrid directly. By doing so, you essentially get a representation of the XamDataGrid in the state that it was exported in, as the grid will never be paginated prior to the export happening. So, while it is possible to print any UIElement with our WPF Reporting framework, the XamDataGrid will not paginate unless exported directly.

    It sounds like the behavior that you are looking to achieve is that you would like to print a paginated XamDataGrid with your other elements either directly above or below the grid in the exported file. I don't personally see how the PagePresenterStyle would help with this, to be honest, as the ContentPresenters in the default template of the ReportPagePresenter are used internally with the export. One thing you could try is to print your XamDataGrid in its own EmbeddedVisualReportSection and print the rest of your elements within a container in their own EmbeddedVisualReportSections. The only issue with this is that there will be a page break between each exported section, which is expected behavior as well, as it is built into the visual pager used for the export.

    Regarding your side question, the ability to export reports to PDF instead of XPS has been determined to be a new product idea. This was suggested some time ago by another Infragistics community member and can be viewed here: https://es.infragistics.com/community/ideas. As a member of the Infragistics community, you can vote on the features and suggestions that you would like to see added to the products, resulting in the most popular features bubbling up to the top. When planning new releases, our product management team will look at the most popular features and use your feedback to prioritize upcoming work. If you would also like to possibly change the current behavior of the EmbeddedVisualReportSections of the Infragistics Reporting framework, I would also recommend suggesting a new product idea for it at https://es.infragistics.com/community/ideas.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer
    Infragistics Inc.
    www.infragistics.com/support

Reply Children
No Data