fpspreadsheet: Fix format in predefined test files (test*_1899*.* and test*_1904*.*); fix biff8 ignoring cell format in shared formula range.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4108 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-05-02 14:25:39 +00:00
parent 3902f75dfc
commit 080efbf542
7 changed files with 14 additions and 4 deletions

View File

@ -1197,6 +1197,12 @@ var
err: TsErrorValue; err: TsErrorValue;
ok: Boolean; ok: Boolean;
cell: PCell; cell: PCell;
fmt: TsCellFormat;
begin begin
{ Index to XF Record } { Index to XF Record }
ReadRowColXF(AStream, ARow, ACol, XF); ReadRowColXF(AStream, ARow, ACol, XF);
@ -1217,7 +1223,9 @@ begin
InitCell(ARow, ACol, FVirtualCell); InitCell(ARow, ACol, FVirtualCell);
cell := @FVirtualCell; cell := @FVirtualCell;
end else end else
cell := FWorksheet.AddCell(ARow, ACol); // "Real" cell cell := FWorksheet.GetCell(ARow, ACol); // "Real" cell
// Don't call "AddCell" because, if the cell belongs to a shared formula, it
// already has been created before, and then would exist in the tree twice.
// Now determine the type of the formula result // Now determine the type of the formula result
if (Data[6] = $FF) and (Data[7] = $FF) then if (Data[6] = $FF) and (Data[7] = $FF) then
@ -1243,9 +1251,9 @@ begin
{Find out what cell type, set content type and value} {Find out what cell type, set content type and value}
ExtractNumberFormat(XF, nf, nfs); ExtractNumberFormat(XF, nf, nfs);
if IsDateTime(ResultFormula, nf, nfs, dt) then if IsDateTime(ResultFormula, nf, nfs, dt) then
FWorksheet.WriteDateTime(cell, dt, nf, nfs) FWorksheet.WriteDateTime(cell, dt) //, nf, nfs)
else else
FWorksheet.WriteNumber(cell, ResultFormula, nf, nfs); FWorksheet.WriteNumber(cell, ResultFormula); //, nf, nfs);
end; end;
{ Formula token array } { Formula token array }
@ -2025,7 +2033,9 @@ begin
InitCell(r1, c1, FVirtualCell); InitCell(r1, c1, FVirtualCell);
cell := @FVirtualCell; cell := @FVirtualCell;
end else end else
cell := FWorksheet.AddCell(r1, c1); // "Real" cell cell := FWorksheet.GetCell(r1, c1); // "Real" cell
// Don't use "AddCell" here because this cell already exists in files written
// by Excel, and this would destroy its formatting.
// Unused // Unused
AStream.ReadByte; AStream.ReadByte;