This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Mar 15th, 2010  |  syntax: Delphi  |  size: 1.04 KB  |  views: 92  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.   Procedure ToTiff(p_Printer: PrinterDriver; p_InputFile, p_OutputFile: String);
  2.   var ExcelApp: ExcelApplication;
  3.   var Workbook: ExcelWorkbook;
  4.   var Worksheet: ExcelWorksheet;
  5.   var ReadOnly: OleVariant;
  6.   var Missing: OleVariant;
  7.   var LocaleID: Integer;
  8.   var SaveChanges: OleVariant;
  9.   begin
  10.     // Create a Excel's Application object
  11.     ExcelApp := CoExcelApplication.Create;
  12.  
  13.     ReadOnly := True;
  14.     Missing := Variants.EmptyParam;
  15.  
  16.     // Set en-US locale or call GetThreadLocale
  17.     LocaleID := $0409;
  18.     Workbook := ExcelApp.Workbooks.Open(p_InputFile, 2, ReadOnly, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, LocaleID);
  19.  
  20.     // Loop through each worksheet
  21.     for Worksheet in Workbook.Worksheets do
  22.     begin
  23.       Writeln(' - Processing worksheet ', Worksheet.Index, ' (', Worksheet.Name, ')');
  24.     end;
  25.  
  26.     // Close the workbook and exit excel
  27.     SaveChanges := False;
  28.     Workbook.Close(SaveChanges, Missing, Missing, LocaleID);
  29.     ExcelApp.Quit;
  30.   end;
clone this paste RAW Paste Data