export TsWorkbook in OpenOffice-format crashes
Original Reporter info from Mantis: TErxleben
-
Reporter name: Torsten Erxleben
Original Reporter info from Mantis: TErxleben
- Reporter name: Torsten Erxleben
Description:
Crashlocation: unit fpszipper line 533. Function below is called internally with DT=0, resulting in invalid expression Y:=Y-1980
Procedure DateTimeToZipDateTime(DT : TDateTime; out ZD,ZT : Word);
Var
Y,M,D,H,N,S,MS : Word;
begin
DecodeDate(DT,Y,M,D);
DecodeTime(DT,H,N,S,MS);
Y:=Y-1980;
ZD:=d+(32*M)+(512*Y);
ZT:=(S div 2)+(32*N)+(2048*h);
end;
Additional information:
Solution??
Procedure DateTimeToZipDateTime(DT : TDateTime; out ZD,ZT : Word);
Var
Y,M,D,H,N,S,MS : Word;
begin
// added code
if DT = 0 then
DT := now();
DecodeDate(DT,Y,M,D);
DecodeTime(DT,H,N,S,MS);
Y:=Y-1980;
ZD:=d+(32*M)+(512*Y);
ZT:=(S div 2)+(32*N)+(2048*h);
end;
Mantis conversion info:
- Mantis ID: 25899
- OS: Kubuntu
- OS Build: 14.04
- Build: v1.3 44477
- Platform: Intel
- Version: 1.2.1 (SVN)