Reputation: 51
Can anybody tell me how to export an excel spreadsheet to pdf using delphi code?
I know there is a command in the MS Word OLE object for exporting to PDf, but I cannot find anything about Excel.
Word To PDF Example:
Const
wdExportFormatPDF = 17;
WrdDoc.ExportAsFixedFormat(SaveToFile, wdExportFormatPDF);
Upvotes: 0
Views: 5003
Reputation: 612794
The correct code is
wb.ExportAsFixedFormat(xlTypePDF, FileName);
or
sheet.ExportAsFixedFormat(xlTypePDF, FileName);
where wb
is a workbook and sheet
is a worksheet. If for some reason, your import library does not define xlTypePDF
, it has value 0.
Some documentation links:
If you read the documentation carefully you will discover that you have been passing the parameters in the wrong order.
Upvotes: 1