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?

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.