Back to Devexpress

IWorkbook.ExportToPdf(String, PdfExportOptions) Method

officefileapi-devexpress-dot-spreadsheet-dot-iworkbook-dot-exporttopdf-x28-system-dot-string-devexpress-dot-xtraprinting-dot-pdfexportoptions-x29.md

latest2.7 KB
Original Source

IWorkbook.ExportToPdf(String, PdfExportOptions) Method

SECURITY-RELATED CONSIDERATIONS

Using file paths sourced from untrusted input may expose unauthorized files or allow unintended file access. Always validate and normalize all external paths to prevent path manipulation.

Exports the workbook to the specified file path in PDF format using the specified options.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
void ExportToPdf(
    string fileName,
    PdfExportOptions options
)
vb
Sub ExportToPdf(
    fileName As String,
    options As PdfExportOptions
)

Parameters

NameTypeDescription
fileNameString

A String which specifies the file name (including the full path) for the created PDF file.

| | options | PdfExportOptions |

A PdfExportOptions object specifying export settings.

|

Remarks

The following code snippet exports the spreadsheet document as a PDF file with the specified settings:

csharp
IWorkbook workbook = spreadsheetControl1.Document;
PdfExportOptions options = new PdfExportOptions();
options.DocumentOptions.Author = "John Doe";
options.DocumentOptions.Title = "Breakeven Analysis";
options.ImageQuality = PdfJpegImageQuality.Medium;
options.ExportBookmarks = false;

workbook.ExportToPdf("Documents\\Document_PDF.pdf", options);
vb
Dim workbook As IWorkbook = spreadsheetControl1.Document
Dim options As New PdfExportOptions()
options.DocumentOptions.Author = "John Doe"
options.DocumentOptions.Title = "Breakeven Analysis"
options.ImageQuality = PdfJpegImageQuality.Medium
options.ExportBookmarks = False

workbook.ExportToPdf("Documents\Document_PDF.pdf", options)

See Also

IWorkbook Interface

IWorkbook Members

DevExpress.Spreadsheet Namespace