AOverwriteExisting unreliable? lazarus / 49-FPSpreadsheet ---------------------------------------------------------------------- namdoog · 2017-10-25 22:45 I just started using FPSpreadsheet to create simple Excel files, and the AOverwriteExisting parameter seems to be ignored.  Mostly, on my Win10 machine, the program always overwrites the file regardless of the true/false value I am passing. Has anyone else had a similar issue? I am using Lazarus 1.6.4 32-bit under Windows 10, but had the same results compiling with the 64-bit version. Here's a relevant bit of my source: 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 try  workbook.WriteToFile('serial_numbers.xlsx',ssformat,true,[])except  err_memo.Color := clRed;end; [...] Str(qty,s);fname := 'sn_log\'+base+'_1_'+s+'.xlsx';try  workbook.WriteToFile(fname,ssformat,false,[])except  err_memo.Color := clRed;end; ---------------------------------------------------------------------- wp · 2017-10-26 08:18 Good catch. Should be fixed in fpspreadsheet-trunk now. Or, if you use a released version, you should replace method TsCustomSpreadWriter.WriteToFile in unit fpReaderWriter by this code: 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 TsCustomSpreadWriter.WriteToFile(const AFileName: string;  const AOverwriteExisting: Boolean = False; AParams: TsStreamParams = []);var  OutputStream: TStream;begin  if not AOverwriteExisting and FileExists(AFileName) then    raise EFCreateError.CreateFmt(rsFileAlreadyExists, [AFileName]);   if (boFileStream in FWorkbook.Options) then    OutputStream := TFileStream.Create(AFileName, fmCreate)  else  if (boBufStream in Workbook.Options) then    OutputStream := TBufStream.Create(AFileName, fmCreate)  else    OutputStream := TMemoryStream.Create;   try    WriteToStream(OutputStream, AParams);    if OutputStream is TMemoryStream then      (OutputStream as TMemoryStream).SaveToFile(AFileName);  finally    OutputStream.Free;  end;end; ---------------------------------------------------------------------- namdoog · 2017-10-26 12:14 Thanks.  Will patch my copy today.