Skip to main content
A newer version of this page is available. .

How to: Export a Worksheet with Embedded Charts to PDF

To export a workbook to PDF, use the Workbook.ExportToPdf method.

However, to export embedded charts, it is necessary to register the following services:

  • DevExpress.XtraSpreadsheet.Services.Implementation.ChartControllerFactoryService
  • DevExpress.XtraSpreadsheet.Services.Implementation.ChartImageService

The code snippet below illustrates how to accomplish the task.

Imports DevExpress.Spreadsheet
Imports DevExpress.XtraPrinting
Imports DevExpress.XtraSpreadsheet.Services
Imports DevExpress.XtraSpreadsheet.Services.Implementation
            Dim workbook As New Workbook()

            'Register required services. 
            workbook.AddService(GetType(IChartControllerFactoryService), New ChartControllerFactoryService())
            workbook.AddService(GetType(IChartImageService), New ChartImageService())

            workbook.LoadDocument("testDocument.xlsx")
            workbook.ExportToPdf("resultingDocument.pdf")