This sample demonstrates how to print or preview the content of a Grid Grouping Control.
This is how the sample will look after clicking the Print option in the File menu.
This is how the sample will look after clicking the Print Preview option in the File menu.
Implementation
The following code explains how to show a preview of data from the Grid Grouping Control.
GridPrintDocument pd = new GridPrintDocument(this.gridGroupingControl1.TableControl, true); PrintPreviewDialog ppv = new PrintPreviewDialog(); ppv.Document = pd; pd.DefaultPageSettings.Landscape = true; ppv.ShowDialog();
The following code shows how to print data from the data grid.
GridPrintDocument pd = new GridPrintDocument(this.gridGroupingControl1.TableControl); PrintDialog printDialog = new PrintDialog(); printDialog.Document = pd; pd.DefaultPageSettings.Landscape = true; printDialog.ShowDialog();