cancel
Showing results for 
Search instead for 
Did you mean: 

export data to excel file (Delphi)

SOLVED
Highlighted
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 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Contributor

Re: export data to excel file (Delphi)

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/

View solution in original post

1 REPLY 1
Highlighted
Contributor

Re: export data to excel file (Delphi)

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/

View solution in original post

New Here?
Join us and watch the welcome video:
Top Kudoed Authors