Mmm. Reducing the code a bit to 1 row, only multiplication.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
fpspreadsheet;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
const
TOTAL_ROWS = 1; //15;
STARTING_SUMMARY_COL = 3;
var
wb: TsWorkbook;
ws: TsWorksheet;
i: integer;
curRow, row: integer;
myFormula1, myFormula2, myFormula4: TsRPNFormula;
begin
wb := TsWorkbook.Create;
ws := wb.AddWorksheet('Completed jobs');
for curRow := 1 to TOTAL_ROWS do
begin
ws.WriteNumber(curRow, 0, 10); //A1..
ws.WriteNumber(curRow, 1, 20); //B1..
SetLength(myFormula1, 3);
myFormula1[0].ElementKind := fekCell;
myFormula1[0].Col := 0;
myFormula1[0].Row := curRow;
myFormula1[1].ElementKind := fekCell;
myFormula1[1].Col := 1;
myFormula1[1].Row := curRow;
myFormula1[2].ElementKind := fekMul;
ws.WriteRPNFormula(curRow, STARTING_SUMMARY_COL, myFormula1); //C1..
end;
wb.WriteToFile(ExtractFilePath(Application.ExeName) + 'test excel5.xls', sfExcel5, true);
wb.WriteToFile(ExtractFilePath(Application.ExeName) + 'test excel8.xls', sfExcel8, true);
wb.Free;
end;
end.
Same problem.
Attached the program-generated faulty xls8 file and the fixed file (Excel 2002/XP, by pressing F2 and enter in the multiplication cell, D2)
Going to have a look at the way the excel8 format if written... Don't hold too much hope though.