You've already forked lazarus-ccr
fpspreadsheet: Improved detection of date/time values by csv reader.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3671 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -35,9 +35,6 @@
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</Item2>
|
||||
<Item3 Name="Release">
|
||||
@ -73,9 +70,6 @@
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</Item3>
|
||||
</BuildModes>
|
||||
@ -152,9 +146,6 @@
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="5">
|
||||
|
@ -267,6 +267,7 @@ var
|
||||
boolValue: Boolean;
|
||||
currSym: string;
|
||||
warning: String;
|
||||
nf: TsNumberFormat;
|
||||
begin
|
||||
// Empty strings are blank cells -- nothing to do
|
||||
if AText = '' then
|
||||
@ -305,9 +306,17 @@ begin
|
||||
end;
|
||||
|
||||
// Check for a DATE/TIME cell
|
||||
// No idea how to apply the date/time formatsettings here...
|
||||
if IsDateTime(AText, dtValue) then
|
||||
begin
|
||||
FWorksheet.WriteDateTime(ARow, ACol, dtValue);
|
||||
if dtValue < 1.0 then // this is a time alone
|
||||
nf := nfLongTime
|
||||
else
|
||||
if frac(dtValue) = 0.0 then // this is a date alone
|
||||
nf := nfShortDate
|
||||
else // this is date + time
|
||||
nf := nfShortDateTime;
|
||||
FWorksheet.WriteDateTime(ARow, ACol, dtValue, nf);
|
||||
exit;
|
||||
end;
|
||||
|
||||
|
@ -1523,8 +1523,15 @@ begin
|
||||
dec(i);
|
||||
while i >= 1 do
|
||||
begin
|
||||
if not (AText[i] in ['0'..'9']) then begin
|
||||
Result := false;
|
||||
exit;
|
||||
end;
|
||||
// If we find the testSep character again it must be a thousand separator.
|
||||
if AText[i] = testSep then
|
||||
if (AText[i] = testSep) then
|
||||
begin
|
||||
// ... but only if there are 3 numerical digits in between
|
||||
if (testSepPos - i = 4) then
|
||||
begin
|
||||
fs.ThousandSeparator := testSep;
|
||||
// The decimal separator is the "other" character.
|
||||
@ -1534,6 +1541,11 @@ begin
|
||||
fs.DecimalSeparator := '.';
|
||||
done := true;
|
||||
i := 0;
|
||||
end else
|
||||
begin
|
||||
Result := false;
|
||||
exit;
|
||||
end;
|
||||
end
|
||||
else
|
||||
// If we find the "other" separator character, then testSep was a
|
||||
@ -1547,6 +1559,12 @@ begin
|
||||
end;
|
||||
dec(i);
|
||||
end;
|
||||
end else
|
||||
if not (AText[i] in ['0'..'9', '+', '-', 'e', 'E', '%']) then
|
||||
begin
|
||||
Result := false;
|
||||
AWarning := '';
|
||||
exit;
|
||||
end;
|
||||
dec(i);
|
||||
end;
|
||||
|
Reference in New Issue
Block a user