Prints the grid control.
Namespace: DevExpress.XtraGrid
Assembly: DevExpress.XtraGrid.v8.3.dll
Syntax
Visual Basic |
---|
Public Sub Print() |
C# |
---|
public void Print(); |
Remarks
To verify that the grid control can be printed check the IsPrintingAvailable property's value.
Example
The following example demonstrates how to print a GridControl or show its Print Preivew. To do this, you should use either the Print or ShowPrintPreview methods.
Note |
---|
The GridControl can be printed and previewed only if the XtraPrinting Library is available. To verify that printing the Grid is possible, use the IsPrintingAvailable property. |
When printing a Grid, the current print settings will be used to represent a Grid. Note that you can access and change these settings via the GridView.OptionsPrint, BandedGridView.OptionsPrint or CardView.OptionsPrint properties.
C# | Copy Code |
---|---|
using DevExpress.XtraGrid; // ... private void ShowGridPreview(GridControl grid) { // Check whether the GridControl can be previewed. if (!grid.IsPrintingAvailable) { MessageBox.Show("The 'DevExpress.XtraPrinting.v7.2.dll' is not found", "Error"); return; } // Open the Preview window. grid.ShowPrintPreview(); } private void PrintGrid(GridControl grid) { // Check whether the GridControl can be printed. if (!grid.IsPrintingAvailable) { MessageBox.Show("The 'DevExpress.XtraPrinting.v7.2.dll' is not found", "Error"); return; } // Print. grid.Print(); } |