Ask a Question

export data to excel file (Delphi)

SOLVED
MarinaB
Occasional Contributor

export data to excel file (Delphi)

Hi,

 

Anybody have example Delphi script for Export data to excel file.

 

I could find example at support.smartbear.com. 

Thanks.

1 REPLY 1
mikakoistinen
Contributor

More specific question would always give better answers, but if you are looking for tools to write general data to xls file

here is one example.

 

procedure exceldemo;
var  
  app, book,sheet;
  fn,row,col;
begin
  fn := 'c:\temp\foo.xlsx';
  app := Sys.OleObject('Excel.Application');
  if aqFile.Exists(fn) then
    book := app.workbooks.open(fn)
  else       
    book := app.Workbooks.Add();
  sheet := book.sheets(1);
  
  app.DisplayAlerts := false;
  for row := 1 to 10 do
  begin
    for col :=1 to 10 do
    begin
      sheet.cells(row, col) := row * col;
    end;
  end;  
  book.SaveAs(fn);
  app.Quit(); 
end;
Jeemly - Dream Big
https://jeemly.com/
cancel
Showing results for 
Search instead for 
Did you mean: