Ah maybe something different: Did you add the workbook option to read formulas? Otherwise formulas are ignored altogether...
This is my test program with which I tested my commit:
program test;
uses
FPSpreadsheet, FPSTypes, FPSExprParser, XLSXOOXML, FPSOpenDocument;
const
FILE_NAME = '4.xlsx';
// FILE_NAME = '4-R1C1.xlsx';
// FILE_NAME = '4.ods';
// FILE_NAME = 'link_to_other_sheet.xlsx';
var
b: TsWorkbook;
sh: TsWorksheet;
f: PsFormula;
begin
b := TsWorkbook.Create;
try
b.Options := [boReadFormulas];
b.ReadFromFile(FILE_NAME);
sh := b.GetFirstWorksheet;
for f in sh.Formulas do
WriteLn(f^.Text);
b.WriteToFile('444.xlsx', sfOOXML, true);
finally
b.Free;
end;
ReadLn;
end.
It worked. Thanks! b.Options := [boReadFormulas]; - was missing from my code. When I created the example, I thought that this was not important for saving.
There is one more bug, it’s not critical for me, but still. Check it out. It corrupts the file. If the sheets are named like this <light><panel>. I made special codenames for work.
there is a new file in the archive