The Workbook class is defined in the DevExpress.Docs.v19.2.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.
// Specify export options.
PdfExportOptions options = new PdfExportOptions();
options.DocumentOptions.Author = "John Smith";
options.ImageQuality = PdfJpegImageQuality.Medium;
using (FileStream pdfFileStream = new FileStream("Document_PDF.pdf", FileMode.Create))
workbook.ExportToPdf(pdfFileStream, options, "Sheet1", "Sheet2");
' Specify export options.
Dim options As New PdfExportOptions()
options.DocumentOptions.Author = "John Smith"
options.ImageQuality = PdfJpegImageQuality.Medium
Using pdfFileStream As New FileStream("Document_PDF.pdf", FileMode.Create)
workbook.ExportToPdf(pdfFileStream, options, "Sheet1", "Sheet2")
Take into account the following when you call this method:
The events fired by this method's call may occur in a different thread than the target operation.
The operation is not thread safe (documents should not be accessed simultaneously by different threads). Wait until the operation is completed before working with the document, i.e., use the await operator.
The code example below shows how to asynchronously convert an XLSX file to PDF format:
private async void ConvertXlsx2PdfWithCancellation()
using (CancellationTokenSource source = new CancellationTokenSource(10000))
using (Workbook workbook = new Workbook())
await workbook.LoadDocumentAsync("Document.xlsx", source.Token);
await workbook.ExportToPdfAsync("Result.pdf", source.Token);
// Your code to handle cancellation.
Private Async Sub ConvertXlsx2PdfWithCancellation()
Using source As CancellationTokenSource = New CancellationTokenSource(10000)
Using workbook As Workbook = New Workbook()
Await workbook.LoadDocumentAsync("Document.xlsx", source.Token)
Await workbook.ExportToPdfAsync("Result.pdf", source.Token)
Catch __unusedOperationCanceledException1__ As OperationCanceledException
' Your code to handle cancellation.
Export Workbooks with 3-D Charts to PDF in .NET Core Apps on Linux
If you run your .NET Core app on a Linux server distribution or Docker Linux Container, use the following terminal command to install additional libraries to export spreadsheets with 3-D charts to PDF: