Workbook.BeforePrintSheet Event | Office File API | DevExpress Documentation Skip to main content
Row

Workbook.BeforePrintSheet Event

Occurs before printing a workbook.

You need a license for the DevExpress Office & PDF File API Subscription or DevExpress Universal Subscription to use this event in production code.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Docs.v26.1.dll

Declaration

public event BeforePrintSheetEventHandler BeforePrintSheet

Event Data

The BeforePrintSheet event's data class is BeforePrintSheetEventArgs. The following properties provide information specific to this event:

Remarks

The BeforePrintSheet event fires for each worksheet being printed or exported to PDF. To cancel the print/export operation, set e.Cancel to true.

The code sample below shows how to cancel printing or exporting to PDF worksheets with drawing objects (shapes, pictures and charts).

static Workbook workbook;
static void Main(string[] args)
{
    workbook = new Workbook();
    workbook.LoadDocument("Documents\\Spreadsheet Book.xls");
    workbook.BeforePrintSheet += Workbook_BeforePrintSheet;
}

private static void Workbook_BeforePrintSheet(object sender, BeforePrintSheetEventArgs e)
{
    if (workbook.Worksheets[e.Name].Shapes.Count != 0) e.Cancel = true;
}

Implements

See Also
Use of this site constitutes acceptance of our Website Terms of Use and Privacy Policy (Updated). Cookies Settings