WPF Printing Library- Composite Report Printing (Coming soon in v15.1)

Thinking Out Loud
02 June 2015

If you've used our Printing Library to output the contents of container controls such as the DevExpress Data Grid for WPF, you'll probably find this new feature quite useful...as it should reduce the number of pre-built reports you'll have to generate since you'll give your users additional options to print/render the contents of your app's UI.

v15.1 extends the WPF Printing Library with a new CompositeLink class. Much like its WinForms counterpart, CompositeLink for WPF allows you to combine multiple printing links together into a single document.

The code below demonstrates how you can use CompositeLink to print the contents of 2 DevExpress WPF Grid Controls in a single document.

using DevExpress.Xpf.Printing;
using DevExpress.Xpf.Core;
// ...
 
private void Print_Click(object sender, RoutedEventArgs e) {
    List<TemplatedLink> links = new List<TemplatedLink>();
    links.Add(new PrintableControlLink((TableView)grid1.View));
    links.Add(new PrintableControlLink((TableView)grid2.View));
 
    CompositeLink compositeLink = new CompositeLink(links);
    PrintHelper.ShowRibbonPrintPreview(this, compositeLink);
}

As you can see, we create two instances of the Printable ControlLink class (one for each control we want to print) and add them to a list. We then create an instance of CompositeLink class by passing the list of links we wish to combine to its constructor. The final step is to use the generated composite link to output a preview...The final result should look something like this..

DevExpress WPF Printing Library - Composite Control Rendering

We'd love to get your thoughts on this feature - How many of you are currently rendering your UI - giving users the option to print/export the contents of UI Controls like our WPF Grid?

1 comment(s)
Quentin Suckling
Quentin Suckling

Looks good!

I have quite a few views that the users can print from.

What container controls are supported for printing?

For example, a pivot grid with linked charts? Can they both be linked in the one document?

But I think the one container control that would be most useful in displaying linked to a grid would be the LayoutControl.

Most of the grid controls I use have a detail panel that shows when a row is selected (either in the line row detail area or at the left or bottom of the screen).

The detail display is composed with a LayoutControl and LayoutGroups/Items.

If that could be linked and displayed with the grid that would be perfect!

Another question, can you position where the linked controls are displayed when printing? i.e Can you have them displayed horizontally?

In the example above, if your category list was 100,000 rows, you'd have to go all the way to the bottom to see the products for the first category.

Cheers,

Quentin

2 June, 2015

Please login or register to post comments.