2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
Print the gridThe GridPrintDocument class implements the printing logic needed to print multi-page Grids. For example, here is a button click event handler that shows you how to use this GridPrintDocument class.
C# private void Print_Click(object sender, EventArgs e) { if (gridControl1 != null) { try { GridPrintDocument gpd = new GridPrintDocument(this.gridControl1); PrintDialog pd = new PrintDialog(); pd.Document = gpd; pd.AllowSelection = true; pd.AllowSomePages = true; DialogResult result = pd.ShowDialog(); if (result == DialogResult.OK) { gpd.Print(); } } catch (Exception ex) { MessageBox.Show("Error Occured" + ex.Message); } } }
VB Private Sub Print_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click If gridControl1 IsNot Nothing Then Try Dim gpd As New GridPrintDocument(Me.gridControl1) Dim pd As New PrintDialog() pd.Document = gpd pd.AllowSelection = True pd.AllowSomePages = True Dim result As DialogResult = pd.ShowDialog() If result = System.Windows.Forms.DialogResult.OK Then gpd.Print() End If Catch ex As Exception MessageBox.Show("Error Occured" & ex.Message) End Try End If End Sub
Samples: C#: Print the grid VB: Print the grid
Reference link: https://help.syncfusion.com/windowsforms/grid-control/printing |
2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.