How to: Export a Workbook to PDF
Important
The Workbook class is defined in the DevExpress.Docs.v19.1.dll assembly. Add this assembly to your project to use the workbook functionality. You require a license to the DevExpress Office File API or DevExpress Universal Subscription to use this assembly in production code. Refer to the DevExpress Subscription page for pricing information.
This example demonstrates how to save a workbook in PDF format using the Workbook.ExportToPdf method.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/spreadsheet-document-server-api-e4339
using (FileStream pdfFileStream = new FileStream("Documents\\Document_PDF.pdf", FileMode.Create))
{
workbook.ExportToPdf(pdfFileStream);
}
Tip
Handle the Workbook.BeforePrintSheet event to cancel exporting the specific worksheet(s).
See Also