Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. procedure TForm1.ExcelToPDF(const AFilename: string);
  2. Const
  3. XlTypePDF = 0;
  4. xlQualityStandard = 0;
  5. IncludeDocProperties = true;
  6. IgnorePrintAreas = false;
  7. LandscapeMode = 2;
  8. var
  9. P: OleVariant;
  10. begin
  11. P:= CreateOleObject('Excel.Application');
  12. try
  13. P.WorkBooks.Open(AFilename, 3);
  14. p.ActiveSheet.Pagesetup.Orientation := LandscapeMode; orientation
  15. p.ActiveSheet.PageSetup.FitToPagesWide := 1; // <-- not supported by automation object
  16. p.ActiveWorkbook.exportAsFixedFormat(xlTypePDF,
  17. AFilename,
  18. xlQualityStandard,
  19. IncludeDocProperties,
  20. IgnorePrintAreas );
  21. finally
  22. p.Quit;
  23. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement