You've already forked lazarus-ccr
fpspreadsheet: Ignore content detection when a cell is formatted as text (nfText).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7063 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -5254,23 +5254,44 @@ begin
|
|||||||
|
|
||||||
DeleteFormula(ACell);
|
DeleteFormula(ACell);
|
||||||
|
|
||||||
|
// Empty cell
|
||||||
if AValue = '' then
|
if AValue = '' then
|
||||||
begin
|
begin
|
||||||
WriteText(ACell, '');
|
WriteText(ACell, '');
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{
|
||||||
// Force text format by putting an apostrophe at the text beginning
|
// Force text format by putting an apostrophe at the text beginning
|
||||||
if AValue[1] = '''' then
|
if AValue[1] = '''' then
|
||||||
begin
|
begin
|
||||||
Delete(AValue, 1, 1);
|
Delete(AValue, 1, 1);
|
||||||
WriteNumberFormat(ACell, nfText);
|
WriteNumberFormat(ACell, nfText);
|
||||||
end;
|
end;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Typing an apostrophe in front of the text bypasses format detection and
|
||||||
|
// takes the text literally.
|
||||||
|
if AValue[1] = '''' then begin
|
||||||
|
WriteText(ACell, Copy(AValue, 2, MaxInt));
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Cell format
|
||||||
fmtIndex := GetEffectiveCellFormatIndex(ACell);
|
fmtIndex := GetEffectiveCellFormatIndex(ACell);
|
||||||
fmt := Workbook.GetCellFormat(fmtIndex);
|
fmt := Workbook.GetCellFormat(fmtIndex);
|
||||||
numFmtParams := Workbook.GetNumberFormat(fmt.NumberFormatIndex);
|
numFmtParams := Workbook.GetNumberFormat(fmt.NumberFormatIndex);
|
||||||
ACell^.FormatIndex := fmtIndex;
|
ACell^.FormatIndex := fmtIndex;
|
||||||
|
|
||||||
|
// Handle some cases first in which content autodetection is not wanted.
|
||||||
|
if not (soAutoDetectCellType in FOptions) then begin
|
||||||
|
// Write text content if the cell has number format nfText
|
||||||
|
if IsTextFormat(numFmtParams) then begin
|
||||||
|
WriteText(ACell, AValue);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
isPercent := Pos('%', AValue) = Length(AValue);
|
isPercent := Pos('%', AValue) = Length(AValue);
|
||||||
if isPercent then Delete(AValue, Length(AValue), 1);
|
if isPercent then Delete(AValue, Length(AValue), 1);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user