[SOLVED] Program Flow, will it wait to execute after pevious line finished? lazarus / 21-General ---------------------------------------------------------------------- incendio · 2022-02-05 05:10 Hi guys, I am using FPSpreadsheet to write data from database to xlsx file. After file written, file is opened via code. The codes is something like this Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TFrm.btnExcelClick(Sender: TObject);var  WB: TsWorkbook;  WS: TsWorksheet; begin  try    WB := TsWorkbook.Create;    WS := WB.AddWorksheet('Sheet');        // do some processing    WB.WriteToFile('fl.xlsx',true);    OpenDocument('fl.xlsx');  finally  WB := free;  end;end;  I am concern when WriteToFile command take sometime to finished written to file on a large database. Is OpenDocument command will execute after file written finished or not? ---------------------------------------------------------------------- dseligo · 2022-02-05 05:51 Quote from: incendio on February 05, 2022, 06:10:21 amI am concern when WriteToFile command take sometime to finished written to file on a large database. Is OpenDocument command will execute after file written finished or not? It will. ---------------------------------------------------------------------- incendio · 2022-02-05 06:02 Thanks for the confirmation.