Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

GridControl.IsPrintingAvailable Property

Indicates whether the grid control can be printed/exported.

Namespace: DevExpress.XtraGrid

Assembly: DevExpress.XtraGrid.v24.2.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

#Declaration

[DXCategory("Printing")]
[Browsable(false)]
public bool IsPrintingAvailable { get; }

#Property Value

Type Description
Boolean

true if the grid control can be printed/exported; otherwise, false.

#Remarks

The grid control can be printed/exported if the XtraPrinting Library is available.

#Example

The following example demonstrates how to print a Grid Control or show its Print Preview. To do this, you should use either the GridControl.Print or GridControl.ShowPrintPreview methods.

Note

The Grid Control can be printed and previewed only if the XtraPrinting Library is available. To verify that printing the Grid is possible, use the GridControl.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.

using DevExpress.XtraGrid;
// ...

private void ShowGridPreview(GridControl grid) {
    // Check whether the GridControl can be previewed.
    if (!grid.IsPrintingAvailable) {
        MessageBox.Show("The 'DevExpress.XtraPrinting' library 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' library is not found", "Error");
        return;
    }

    // Print.
    grid.Print();
}
See Also