SpreadsheetControl.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 content of the SpreadsheetControl to the specified file in PDF format using the specified options.
Namespace: DevExpress.XtraSpreadsheet
Assembly: DevExpress.XtraSpreadsheet.v26.1.dll
Declaration
Parameters
| Name | Type | Description |
|---|---|---|
| fileName | String | A String which specifies the name (including the full path) of the PDF file to which the data is exported. |
| pdfExportOptions | PdfExportOptions | A PdfExportOptions object which specifies the PDF export options. |
Remarks
Refer to the Export to PDF document to learn about PDF export features and limitations.
Example
The following code snippet saves a document in PDF format with the specified settings:
using DevExpress.Spreadsheet;
using System.IO;
//...
// Access a workbook.
IWorkbook workbook = spreadsheetControl.Document;
// Load a document.
workbook.LoadDocument(@"Documents\Document.xlsx", DocumentFormat.Xlsx);
DevExpress.XtraPrinting.PdfExportOptions options = new DevExpress.XtraPrinting.PdfExportOptions();
options.DocumentOptions.Author = "Mark Jones";
options.Compressed = false;
options.ImageQuality = DevExpress.XtraPrinting.PdfJpegImageQuality.High;
// Save the workbook as a PDF file.
workbook.ExportToPdf("Document_PDF.pdf", options);
See Also