Thanks for your help, with the change the formulas are no longer erased, only that when checking the contents of the file some do not calculate anything, look:
MyWorkBook := TsWorkbook.Create;
MyWorkbook.Options := MyWorkbook.Options + [
boReadFormulas, // necessary to read formulas
boAutoCalc // automatically recalculate worksheet if values change, or trigger recalculation manually
];
MyWorkBook.ReadFromFile('Radicador\plantilla_radicador.xls', sfExcel8);
MyWorkSheet := MyWorkBook.GetWorksheetByName('Radicador');
fil := 1;
The following formulas don't work:
Column P: =SI.ERROR(BUSCARV(S2;Variables!$K$2:$L$163;2;FALSO);"")
Column R: =SI(J2="GD";E2;SI(J2="GC";F2;""))
Column S: =SI(J2="GD";5;10)
In each cells appears #¡VALOR!
col := 0;
while not SQLQuery1.EOF do begin
for col := 0 to SQLQuery1.FieldCount - 1 do
MyWorkSheet.WriteText(fil, col, Trim(SqlQuery1.Fields[col].AsString));
inc(fil);
SQLQuery1.Next;
end;
MyWorkbook.WriteToFile(SaveDialog1.FileName + STR_EXCEL_EXTENSION, sfExcel8);
MyWorkbook.Free;
SQLQuery1.Close;