From bf61320db85d6d0ff23ae8d886ee4401ee9315f4 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Thu, 8 Jan 2015 12:14:59 +0000 Subject: [PATCH] fpspreadsheet: Fix compilation of fpspreadsheet packages back to Laz 1.2.0 / fpc 2.6.2 (Note: some "ignored" unit tests do produce a failure). git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3876 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpspreadsheet/fpsopendocument.pas | 2 +- components/fpspreadsheet/fpsutils.pas | 14 ++++++++++++++ components/fpspreadsheet/xlsxooxml.pas | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/components/fpspreadsheet/fpsopendocument.pas b/components/fpspreadsheet/fpsopendocument.pas index 6f5d9c48c..cb1dae72c 100755 --- a/components/fpspreadsheet/fpsopendocument.pas +++ b/components/fpspreadsheet/fpsopendocument.pas @@ -3849,7 +3849,7 @@ begin if VarType(value) = varDate then begin lCell.ContentType := cctDateTime; - lCell.DateTimeValue := StrToDate(VarToStr(value), Workbook.FormatSettings); + lCell.DateTimeValue := StrToDateTime(VarToStr(value), Workbook.FormatSettings); // was: StrToDate end else if VarIsStr(value) then begin diff --git a/components/fpspreadsheet/fpsutils.pas b/components/fpspreadsheet/fpsutils.pas index f62037e88..6e4cb1aa2 100644 --- a/components/fpspreadsheet/fpsutils.pas +++ b/components/fpspreadsheet/fpsutils.pas @@ -177,6 +177,12 @@ procedure Unused(const A1, A2, A3); { For debugging purposes } procedure DumpFontsToFile(AWorkbook: TsWorkbook; AFileName: String); +{ Needed only if FPC version is < 2.6.4 } +{$IF FPC_FULLVERSION < 020604} +function VarIsBool(const V: Variant): Boolean; +{$ENDIF} + + var {@@ Default value for the screen pixel density (pixels per inch). Is needed for conversion of distances to pixels} @@ -187,6 +193,7 @@ var implementation uses + //LCLVersion, Math, lazutf8, fpsStrings; type @@ -2754,6 +2761,13 @@ begin end; end; +{$IF FPC_FULLVERSION < 020604} +function VarIsBool(const V: Variant): Boolean; +begin + Result := (TVarData(V).vType and varTypeMask) = varboolean; +end; +{$ENDIF} + initialization InitUTF8FormatSettings; diff --git a/components/fpspreadsheet/xlsxooxml.pas b/components/fpspreadsheet/xlsxooxml.pas index 56e886fe7..949c2c1ee 100755 --- a/components/fpspreadsheet/xlsxooxml.pas +++ b/components/fpspreadsheet/xlsxooxml.pas @@ -1961,7 +1961,7 @@ begin if VarType(value) = varDate then begin lCell.ContentType := cctDateTime; - lCell.DateTimeValue := StrToDate(VarToStr(value), Workbook.FormatSettings); + lCell.DateTimeValue := StrToDateTime(VarToStr(value), Workbook.FormatSettings); // was: StrToDate end else if VarIsStr(value) then begin