Advertisement
Guest User

Untitled

a guest
Mar 15th, 2010
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.04 KB | None | 0 0
  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;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement