This example demonstrates how to use the Snap Control facilities to generate an "editable" report based on GridControl content.
The SnapControl provides a corresponding API to generate a SnapDocument layout at runtime, including creating master-detail lists, grouping, sorting, etc.
How to generate a document layout in code via the Snap application programming interface (API)
The main benefit of using the SnapControl component to generate GridControl's report is that an end-user operates with a "live" editable document, whose layout can be customized like a regular Word document, and all changes made in a document layout are immediately applied to current report content (report data).
To build the solution demonstrated in this sample into an existing application, copy the "SnapReportForGridGenerator" and "SnapReportFormGenerator" files into your project and use a corresponding extension method to generate a Snap report for current GridControl data:
[C#]gridControl1.ShowSnapReportPreviewForm();
Take special note that this approach requires adding corresponding assemblies into your project.
The following video demonstrates how to customize a generated SnapDocument at runtime, save all changes made at runtime in the SNX format and restore them on further generating a report:
An extended version of this video (which also demonstrates how to display headers for each master row) is available (is built-in) in C# and VB solutions of this example (the "Snap_Report_Customization.swf" file).
A key point is that any changes made in the SnapDocument affect only a current record template. To apply the changes for a whole document, you need to force updating all SnapList records in the document.
The simplest solution to achieve this is to click a record next to the currently edited one.
P.S. This approach has the following limitations:
1. In case of a large amount of data (a large number of records in the GirdControl view), there can be performance issues on rendering and calculating the layout of the SnapControl document.
2. The SnapControl does not support Server Mode data sources.